231 lines
7.1 KiB
YAML
231 lines
7.1 KiB
YAML
|
|
# TODO Install python if not done
|
|
# Or maybe not, it requires a lot of automation for something that can be done
|
|
# very quickly manually and is usually already installed
|
|
|
|
- name: Install python-apt dependency for Termux
|
|
block:
|
|
# TODO Check if the correct version
|
|
- name: Check for DistUtilsExtra (Termux)
|
|
command: python -c 'import DistUtilsExtra'
|
|
changed_when: False
|
|
rescue:
|
|
- name: Create temporarty folder for DistUtilsExtra (Termux)
|
|
tempfile:
|
|
state: directory
|
|
suffix: python-distutils-extra
|
|
# path: /data/data/com.termux/files/usr/tmp/
|
|
register: pde_tempdir
|
|
|
|
- name: Download DistUtilsExtra (Termux)
|
|
get_url:
|
|
url: "https://launchpad.net/python-distutils-extra/trunk/{{ version }}/+download/python-distutils-extra-{{ version }}.tar.gz"
|
|
dest: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
|
|
|
|
- name: Extract DistUtilsExtra (Termux)
|
|
unarchive:
|
|
src: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
|
|
remote_src: yes
|
|
dest: "{{ pde_tempdir.path }}"
|
|
|
|
- name: Install DistUtilsExtra (Termux)
|
|
command:
|
|
cmd: python3 setup.py install
|
|
chdir: "{{ pde_tempdir.path }}/python-distutils-extra-{{ version }}"
|
|
when: termux
|
|
vars:
|
|
version: 2.39
|
|
|
|
- name: Install python-apt (Termux)
|
|
pip:
|
|
name: python-apt
|
|
when: termux
|
|
|
|
# Collecting python-apt
|
|
# Using cached python-apt-0.7.8.tar.bz2 (49 kB)
|
|
# ERROR: Command errored out with exit status 1:
|
|
# command: /data/data/com.termux/files/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-dsga__i7/python-apt/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-dsga__i7/python-apt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-ptpprl0m
|
|
# cwd: /data/data/com.termux/files/usr/tmp/pip-install-dsga__i7/python-apt/
|
|
# Complete output (5 lines):
|
|
# Traceback (most recent call last):
|
|
# File "<string>", line 1, in <module>
|
|
# File "/data/data/com.termux/files/usr/tmp/pip-install-dsga__i7/python-apt/setup.py", line 11, in <module>
|
|
# string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]))
|
|
# AttributeError: module 'string' has no attribute 'split'
|
|
# ----------------------------------------
|
|
# ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
|
|
# WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
|
|
# You should consider upgrading via the '/data/data/com.termux/files/usr/bin/python3 -m pip install --upgrade pip' command.
|
|
|
|
# Arch configuration
|
|
|
|
# TODO Patch sudo-fake so it allows using -u so `become` works
|
|
|
|
- name: Enable multilib repo
|
|
lineinfile:
|
|
path: /etc/pacman.conf
|
|
regexp: '^#?\s*\[multilib\]$'
|
|
line: '[multilib]'
|
|
become: yes
|
|
when: arch_based and ansible_architecture == "x86_64"
|
|
notify: udpate pacman cache
|
|
|
|
- name: Configure multilib repo
|
|
lineinfile:
|
|
path: /etc/pacman.conf
|
|
regexp: '^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist'
|
|
line: 'Include = /etc/pacman.d/mirrorlist'
|
|
insertafter: '^\[multilib\]$'
|
|
become: yes
|
|
when: arch_based and ansible_architecture == "x86_64"
|
|
notify: udpate pacman cache
|
|
|
|
- name: Update cache if needed
|
|
meta: flush_handlers
|
|
|
|
- name: Install ccache
|
|
pacman:
|
|
name: ccache
|
|
state: present
|
|
extra_args: "--asdeps"
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Enable makepkg color
|
|
replace:
|
|
path: /etc/makepkg.conf
|
|
regexp: '^BUILDENV=(.+)!color(.+)$'
|
|
replace: 'BUILDENV=\1color\2'
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Enable makepkg ccache
|
|
replace:
|
|
path: /etc/makepkg.conf
|
|
regexp: '^BUILDENV=(.+)!ccache(.+)$'
|
|
replace: 'BUILDENV=\1ccache\2'
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Remove -mtune from makepkg CFLAGS
|
|
replace:
|
|
path: /etc/makepkg.conf
|
|
regexp: '^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$'
|
|
replace: "CFLAGS=\\1\\2"
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Change -march to native from makepkg CFLAGS
|
|
replace:
|
|
path: /etc/makepkg.conf
|
|
regexp: '^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$'
|
|
replace: "CFLAGS=\\1-march=native\\2\\3"
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Set makepkg MAKEFLAGS
|
|
replace:
|
|
path: /etc/makepkg.conf
|
|
regexp: '^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$'
|
|
replace: "MAKEFLAGS=\\1-j{{ j }}\\2"
|
|
become: yes
|
|
vars:
|
|
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
|
|
when: arch_based
|
|
|
|
- name: Enable pacman ParallelDownloads
|
|
lineinfile:
|
|
path: /etc/pacman.conf
|
|
regexp: '^#?ParallelDownloads'
|
|
line: 'ParallelDownloads = 5'
|
|
insertafter: '^\[options\]$'
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Enable pacman colors
|
|
lineinfile:
|
|
path: /etc/pacman.conf
|
|
regexp: '^#?Color'
|
|
line: 'Color'
|
|
insertafter: '^\[options\]$'
|
|
become: yes
|
|
when: arch_based
|
|
|
|
- name: Enable pacman pac-man
|
|
lineinfile:
|
|
path: /etc/pacman.conf
|
|
regexp: '^#?ILoveCandy'
|
|
line: 'ILoveCandy'
|
|
insertafter: '^#?Color'
|
|
become: yes
|
|
when: arch_based
|
|
|
|
|
|
# Install alternative package managers
|
|
- name: List packages from base-devel
|
|
command: pacman -Sqg base-devel
|
|
register: base_devel_packages
|
|
changed_when: no
|
|
check_mode: no
|
|
|
|
- name: Install dependencies for AUR helpers
|
|
pacman:
|
|
name: "{{ (base_devel_packages.stdout | split('\n') | reject('eq', 'sudo')) + ['fakeroot'] }}"
|
|
become: yes
|
|
when: arch_based
|
|
# Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts)
|
|
# It should already be installed already anyway
|
|
|
|
- name: Install AUR package manager (Arch)
|
|
aur:
|
|
name: yay-bin
|
|
when: arch
|
|
|
|
- name: Install AUR package manager (Manjaro)
|
|
pacman:
|
|
name: yay
|
|
become: yes
|
|
when: manjaro
|
|
# Not sure if regular Manjaro has yay in its community packages,
|
|
# but Manjaro-ARM sure does
|
|
|
|
- name: Create cache folder
|
|
file:
|
|
state: directory
|
|
mode: "u=rwx,g=rx,o=rx"
|
|
path: "{{ ansible_user_dir }}/.cache/automatrop"
|
|
|
|
- name: Generate list of packages for package manager
|
|
set_fact:
|
|
packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}"
|
|
tags: softwarelist
|
|
|
|
- name: Install packages (Arch-based)
|
|
aur:
|
|
name: "{{ packages }}"
|
|
extra_args: "--asdeps --needed"
|
|
# Nothing is set as installed manually so it can
|
|
# be removed by dependency check.
|
|
# Current packages will be kept by the meta package
|
|
use: yay
|
|
notify: "software changed"
|
|
tags: softwarelist
|
|
when: arch_based
|
|
|
|
- name: Check if list of packages changed
|
|
copy:
|
|
content: "{% for package in packages %}{{ package }}\n{% endfor %}"
|
|
dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager"
|
|
notify: "software changed"
|
|
tags: softwarelist
|
|
|
|
# translate-shell
|
|
# $ curl -L git.io/trans > ~/.local/bin/trans
|
|
# $ chmod +x ~/.local/bin/trans
|
|
|
|
# sct
|
|
# $ TMP=$(mktemp /tmp/XXXXXXXXXX.c)
|
|
# $ wget https://gist.githubusercontent.com/ajnirp/208c03d3aa7f02c743d2/raw/55bf3eed25739173d8be57b5179ed5542cf40ed6/sct.c -O $TMP
|
|
# $ cc $TMP --std=c99 -lX11 -lXrandr -o $HOME/.local/bin/sct
|
|
# $ rm $TMP
|