2023-11-02 19:51:54 +01:00
|
|
|
---
|
2021-01-10 14:57:06 +01:00
|
|
|
# TODO Install python if not done
|
2021-06-12 17:15:21 +02:00
|
|
|
# Or maybe not, it requires a lot of automation for something that can be done
|
2021-06-18 21:55:19 +02:00
|
|
|
# very quickly manually and is usually already installed
|
2021-01-10 14:57:06 +01:00
|
|
|
|
|
|
|
- name: Install python-apt dependency for Termux
|
2023-11-02 19:51:54 +01:00
|
|
|
when: termux
|
|
|
|
vars:
|
|
|
|
version: 2.39
|
|
|
|
|
2021-01-10 14:57:06 +01:00
|
|
|
block:
|
|
|
|
# TODO Check if the correct version
|
|
|
|
- name: Check for DistUtilsExtra (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.command: python -c 'import DistUtilsExtra'
|
|
|
|
changed_when: false
|
2021-01-10 14:57:06 +01:00
|
|
|
rescue:
|
|
|
|
- name: Create temporarty folder for DistUtilsExtra (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.tempfile:
|
2021-01-10 14:57:06 +01:00
|
|
|
state: directory
|
|
|
|
suffix: python-distutils-extra
|
|
|
|
# path: /data/data/com.termux/files/usr/tmp/
|
|
|
|
register: pde_tempdir
|
|
|
|
|
|
|
|
- name: Download DistUtilsExtra (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: https://launchpad.net/python-distutils-extra/trunk/{{ version }}/+download/python-distutils-extra-{{ version }}.tar.gz
|
2021-01-10 14:57:06 +01:00
|
|
|
dest: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
|
|
|
|
|
|
|
|
- name: Extract DistUtilsExtra (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.unarchive:
|
2021-01-10 14:57:06 +01:00
|
|
|
src: "{{ pde_tempdir.path }}/python-distutils-extra.tar.gz"
|
2023-11-02 19:51:54 +01:00
|
|
|
remote_src: true
|
2021-01-10 14:57:06 +01:00
|
|
|
dest: "{{ pde_tempdir.path }}"
|
|
|
|
|
|
|
|
- name: Install DistUtilsExtra (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.command:
|
2021-01-10 14:57:06 +01:00
|
|
|
cmd: python3 setup.py install
|
|
|
|
chdir: "{{ pde_tempdir.path }}/python-distutils-extra-{{ version }}"
|
|
|
|
- name: Install python-apt (Termux)
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.pip:
|
2021-01-10 14:57:06 +01:00
|
|
|
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.
|
|
|
|
|
2021-06-19 16:52:28 +02:00
|
|
|
# Arch configuration
|
|
|
|
|
2021-12-02 16:55:55 +01:00
|
|
|
# TODO Patch sudo-fake so it allows using -u so `become` works
|
|
|
|
|
|
|
|
- name: Enable multilib repo
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2021-12-02 16:55:55 +01:00
|
|
|
path: /etc/pacman.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#?\s*\[multilib\]$
|
|
|
|
line: "[multilib]"
|
|
|
|
become: true
|
2021-12-02 16:55:55 +01:00
|
|
|
when: arch_based and ansible_architecture == "x86_64"
|
|
|
|
notify: udpate pacman cache
|
|
|
|
|
|
|
|
- name: Configure multilib repo
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2021-12-02 16:55:55 +01:00
|
|
|
path: /etc/pacman.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#?\s*Include\s*=\s*/etc/pacman.d/mirrorlist
|
|
|
|
line: Include = /etc/pacman.d/mirrorlist
|
|
|
|
insertafter: ^\[multilib\]$
|
|
|
|
become: true
|
2021-12-02 16:55:55 +01:00
|
|
|
when: arch_based and ansible_architecture == "x86_64"
|
|
|
|
notify: udpate pacman cache
|
|
|
|
|
|
|
|
- name: Update cache if needed
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.meta: flush_handlers
|
2021-06-19 16:52:28 +02:00
|
|
|
- name: Install ccache
|
2023-11-02 19:51:54 +01:00
|
|
|
community.general.pacman:
|
2021-06-19 16:52:28 +02:00
|
|
|
name: ccache
|
|
|
|
state: present
|
2023-11-02 19:51:54 +01:00
|
|
|
extra_args: --asdeps
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-10-17 14:37:17 +02:00
|
|
|
- name: Enable makepkg color
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.replace:
|
2021-10-17 14:37:17 +02:00
|
|
|
path: /etc/makepkg.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^BUILDENV=(.+)!color(.+)$
|
|
|
|
replace: BUILDENV=\1color\2
|
|
|
|
become: true
|
2021-10-17 14:37:17 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-06-19 16:52:28 +02:00
|
|
|
- name: Enable makepkg ccache
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.replace:
|
2021-06-19 16:52:28 +02:00
|
|
|
path: /etc/makepkg.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^BUILDENV=(.+)!ccache(.+)$
|
|
|
|
replace: BUILDENV=\1ccache\2
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-10-17 14:37:17 +02:00
|
|
|
- name: Remove -mtune from makepkg CFLAGS
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.replace:
|
2021-06-19 16:52:28 +02:00
|
|
|
path: /etc/makepkg.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$
|
|
|
|
replace: CFLAGS=\1\2
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-10-17 14:37:17 +02:00
|
|
|
- name: Change -march to native from makepkg CFLAGS
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.replace:
|
2021-06-19 16:52:28 +02:00
|
|
|
path: /etc/makepkg.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$
|
|
|
|
replace: CFLAGS=\1-march=native\2\3
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
2021-10-17 14:37:17 +02:00
|
|
|
|
|
|
|
- name: Set makepkg MAKEFLAGS
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.replace:
|
2021-10-17 14:37:17 +02:00
|
|
|
path: /etc/makepkg.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#? *MAKEFLAGS=(.+)-j[0-9]+(.+)$
|
|
|
|
replace: MAKEFLAGS=\1-j{{ j }}\2
|
|
|
|
become: true
|
2021-10-17 14:37:17 +02:00
|
|
|
vars:
|
|
|
|
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
|
|
|
|
when: arch_based
|
2021-06-19 16:52:28 +02:00
|
|
|
|
2021-06-21 22:01:48 +02:00
|
|
|
- name: Enable pacman ParallelDownloads
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2021-06-21 22:01:48 +02:00
|
|
|
path: /etc/pacman.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#?ParallelDownloads
|
|
|
|
line: ParallelDownloads = 5
|
|
|
|
insertafter: ^\[options\]$
|
|
|
|
become: true
|
2021-06-21 22:01:48 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-06-19 16:52:28 +02:00
|
|
|
- name: Enable pacman colors
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2021-06-19 16:52:28 +02:00
|
|
|
path: /etc/pacman.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#?Color
|
|
|
|
line: Color
|
|
|
|
insertafter: ^\[options\]$
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
|
|
|
|
|
|
|
- name: Enable pacman pac-man
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2021-06-19 16:52:28 +02:00
|
|
|
path: /etc/pacman.conf
|
2023-11-02 19:51:54 +01:00
|
|
|
regexp: ^#?ILoveCandy
|
|
|
|
line: ILoveCandy
|
|
|
|
insertafter: ^#?Color
|
|
|
|
become: true
|
2021-06-19 16:52:28 +02:00
|
|
|
when: arch_based
|
|
|
|
|
2021-01-10 14:57:06 +01:00
|
|
|
# Install alternative package managers
|
2021-06-12 17:15:21 +02:00
|
|
|
- name: Install dependencies for AUR helpers
|
2023-11-02 19:51:54 +01:00
|
|
|
community.general.pacman:
|
2023-11-02 19:50:00 +01:00
|
|
|
name:
|
|
|
|
- base-devel
|
|
|
|
- fakeroot
|
2023-11-02 19:51:54 +01:00
|
|
|
become: true
|
2021-12-02 16:55:55 +01:00
|
|
|
when: arch_based
|
|
|
|
# Do not install sudo because maybe sudo-fake is installed (otherwise it conflicts)
|
|
|
|
# It should already be installed already anyway
|
2021-06-12 17:15:21 +02:00
|
|
|
|
|
|
|
- name: Install AUR package manager (Arch)
|
2021-01-10 14:57:06 +01:00
|
|
|
aur:
|
|
|
|
name: yay-bin
|
2021-12-02 16:55:55 +01:00
|
|
|
when: arch
|
2021-01-10 14:57:06 +01:00
|
|
|
|
2021-06-12 17:15:21 +02:00
|
|
|
- name: Install AUR package manager (Manjaro)
|
2023-11-02 19:51:54 +01:00
|
|
|
community.general.pacman:
|
2021-06-12 17:15:21 +02:00
|
|
|
name: yay
|
2023-11-02 19:51:54 +01:00
|
|
|
become: true
|
2021-12-02 16:55:55 +01:00
|
|
|
when: manjaro
|
2021-06-12 17:15:21 +02:00
|
|
|
# Not sure if regular Manjaro has yay in its community packages,
|
|
|
|
# but Manjaro-ARM sure does
|
2021-01-10 14:57:06 +01:00
|
|
|
|
2021-06-12 17:15:21 +02:00
|
|
|
- name: Create cache folder
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.file:
|
2021-06-12 17:15:21 +02:00
|
|
|
state: directory
|
2023-11-02 19:51:54 +01:00
|
|
|
mode: u=rwx,g=rx,o=rx
|
2021-06-12 17:15:21 +02:00
|
|
|
path: "{{ ansible_user_dir }}/.cache/automatrop"
|
|
|
|
|
|
|
|
- name: Generate list of packages for package manager
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-06-13 14:45:20 +02:00
|
|
|
packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}"
|
|
|
|
tags: softwarelist
|
|
|
|
|
2021-06-12 17:15:21 +02:00
|
|
|
- name: Install packages (Arch-based)
|
|
|
|
aur:
|
|
|
|
name: "{{ packages }}"
|
2023-11-02 19:51:54 +01:00
|
|
|
extra_args: --asdeps --needed
|
2021-06-12 17:15:21 +02:00
|
|
|
# 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
|
2023-11-02 19:51:54 +01:00
|
|
|
notify: software changed
|
2021-06-12 17:15:21 +02:00
|
|
|
tags: softwarelist
|
2021-12-02 16:55:55 +01:00
|
|
|
when: arch_based
|
|
|
|
|
|
|
|
- name: Check if list of packages changed
|
2023-11-02 19:51:54 +01:00
|
|
|
ansible.builtin.copy:
|
2021-12-02 16:55:55 +01:00
|
|
|
content: "{% for package in packages %}{{ package }}\n{% endfor %}"
|
|
|
|
dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager"
|
2023-11-02 19:51:54 +01:00
|
|
|
notify: software changed
|
2021-12-02 16:55:55 +01:00
|
|
|
tags: softwarelist
|
2021-06-19 16:52:28 +02:00
|
|
|
|
|
|
|
# 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
|