Make ghautomatrop work with Junest

This commit is contained in:
Geoffrey Frogeye 2021-12-02 16:55:55 +01:00
parent 3ff188c80b
commit 2250f520fe
9 changed files with 65 additions and 22 deletions

View file

@ -1 +1 @@
self_hostname self_name

View file

@ -167,6 +167,7 @@
loop: loop:
- pulseaudio - pulseaudio
- mpd - mpd
when: has_systemd
# TODO bar (might change bar in the future, so...) # TODO bar (might change bar in the future, so...)
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config) # TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)

View file

@ -4,9 +4,17 @@
arch: "{{ ansible_lsb.id == 'Arch' }}" arch: "{{ ansible_lsb.id == 'Arch' }}"
manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}" manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}"
termux: "{{ ansible_distribution == 'OtherLinux' and ansible_python.executable == '/data/data/com.termux/files/usr/bin/python' }}" termux: "{{ ansible_distribution == 'OtherLinux' and ansible_python.executable == '/data/data/com.termux/files/usr/bin/python' }}"
debian_based: "{{ ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' }}"
debian: "{{ ansible_distribution == 'Debian' }}" debian: "{{ ansible_distribution == 'Debian' }}"
ubuntu: "{{ ansible_distribution == 'Ubuntu' }}" ubuntu: "{{ ansible_distribution == 'Ubuntu' }}"
junest: "{{ ansible_distribution == 'Archlinux' and ansible_is_chroot }}" # TODO Check if /etc/junest exists
tags:
- always
- name: Set composed facts
set_fact:
debian_based: "{{ debian or ubuntu }}"
can_chown: "{{ not junest }}"
has_systemd: "{{ not junest }}"
tags: tags:
- always - always
# TODO Make this a real Ansible fact maybe? # TODO Make this a real Ansible fact maybe?

View file

@ -15,3 +15,9 @@
listen: "software changed" listen: "software changed"
when: root_access when: root_access
when: arch_based when: arch_based
- name: update pacman cache
pacman:
update_cache: yes
become: yes
when: arch_based

View file

@ -59,6 +59,30 @@
# Arch configuration # 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 - name: Install ccache
pacman: pacman:
name: ccache name: ccache
@ -90,7 +114,6 @@
replace: "CFLAGS=\\1\\2" replace: "CFLAGS=\\1\\2"
become: yes become: yes
when: arch_based when: arch_based
tags: g
- name: Change -march to native from makepkg CFLAGS - name: Change -march to native from makepkg CFLAGS
replace: replace:
@ -99,7 +122,6 @@
replace: "CFLAGS=\\1-march=native\\2\\3" replace: "CFLAGS=\\1-march=native\\2\\3"
become: yes become: yes
when: arch_based when: arch_based
tags: g
- name: Set makepkg MAKEFLAGS - name: Set makepkg MAKEFLAGS
replace: replace:
@ -140,24 +162,30 @@
# Install alternative package managers # 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 - name: Install dependencies for AUR helpers
pacman: pacman:
name: name: "{{ (base_devel_packages.stdout | split('\n') | reject('eq', 'sudo')) + ['fakeroot'] }}"
- fakeroot
- base-devel
become: yes become: yes
when: arch_based and root_access 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) - name: Install AUR package manager (Arch)
aur: aur:
name: yay-bin name: yay-bin
when: arch and root_access when: arch
- name: Install AUR package manager (Manjaro) - name: Install AUR package manager (Manjaro)
pacman: pacman:
name: yay name: yay
become: yes become: yes
when: manjaro and root_access when: manjaro
# Not sure if regular Manjaro has yay in its community packages, # Not sure if regular Manjaro has yay in its community packages,
# but Manjaro-ARM sure does # but Manjaro-ARM sure does
@ -172,13 +200,6 @@
packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}" packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort|unique }}"
tags: softwarelist tags: softwarelist
- 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
- name: Install packages (Arch-based) - name: Install packages (Arch-based)
aur: aur:
name: "{{ packages }}" name: "{{ packages }}"
@ -189,7 +210,14 @@
use: yay use: yay
notify: "software changed" notify: "software changed"
tags: softwarelist tags: softwarelist
when: arch_based and root_access 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 # translate-shell
# $ curl -L git.io/trans > ~/.local/bin/trans # $ curl -L git.io/trans > ~/.local/bin/trans

View file

@ -5,7 +5,7 @@ rsync
borg borg
syncthing syncthing
{% if arch_based %} {% if arch_based %}
{% if ansible_architecture == 'x86_64' %} {% if ansible_architecture == 'x86_64' and can_chown %}
freefilesync-bin freefilesync-bin
{# Not worth the compilation if you can't have the binaries #} {# Not worth the compilation if you can't have the binaries #}
{% endif %} {% endif %}

View file

@ -1,7 +1,9 @@
moreutils moreutils
man man
visidata visidata
{% if can_chown or not arch_based %}
insect insect
{% endif %}
translate-shell translate-shell
gnupg gnupg
{# Editor #} {# Editor #}

View file

@ -3,7 +3,6 @@
vim_variants: vim_variants:
- vim - vim
- nvim - nvim
tags: g
# TODO vim-minimal for bsh # TODO vim-minimal for bsh
# TODO Select those in a clever way # TODO Select those in a clever way
@ -25,7 +24,6 @@
src: loader.j2 src: loader.j2
dest: "{{ ansible_user_dir }}/.config/vim/loader.vim" dest: "{{ ansible_user_dir }}/.config/vim/loader.vim"
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
tags: g
- name: Install theme - name: Install theme
template: template:
@ -54,4 +52,3 @@
loop: "{{ vim_variants }}" loop: "{{ vim_variants }}"
loop_control: loop_control:
loop_var: variant loop_var: variant
tags: g

View file

@ -0,0 +1 @@
gho.geoffrey.frogeye.fr