2022-10-16 05:31:15 +00:00
|
|
|
- include_role:
|
|
|
|
name: per_user
|
|
|
|
apply:
|
|
|
|
become: yes
|
|
|
|
become_user: "{{ build_user.name }}"
|
|
|
|
|
|
|
|
- name: Install packages
|
2023-03-04 13:46:48 +00:00
|
|
|
package:
|
2022-10-16 05:31:15 +00:00
|
|
|
name:
|
2023-01-16 22:05:47 +00:00
|
|
|
- base-devel
|
2022-10-16 05:31:15 +00:00
|
|
|
- gnupg
|
2023-01-16 22:05:47 +00:00
|
|
|
- devtools # Creates /usr/share/devtools/makepkg-x86_64.conf and provides mkarchroot
|
2022-10-16 05:31:15 +00:00
|
|
|
- base-devel
|
2023-03-04 13:46:48 +00:00
|
|
|
- vifm # For aurutils
|
|
|
|
- vim # For aurutils
|
2023-03-18 17:40:43 +00:00
|
|
|
- expect # For aurutils
|
2022-10-16 05:31:15 +00:00
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Extract aurutils aur entry
|
|
|
|
become_user: "{{ build_user.name }}"
|
|
|
|
unarchive:
|
|
|
|
src: https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz
|
|
|
|
dest: "/home/{{ build_user.name }}/.config/ansible_deploy/"
|
|
|
|
remote_src: yes
|
|
|
|
creates: "/home/{{ build_user.name }}/.config/ansible_deploy/aurutils"
|
|
|
|
|
|
|
|
- name: Check trusted gpg keys
|
|
|
|
command: pacman-key -l
|
|
|
|
register: pacmankeys
|
|
|
|
changed_when: false
|
|
|
|
check_mode: no
|
|
|
|
no_log: true
|
|
|
|
|
|
|
|
- name: Trust the signing key for the aurutils package
|
|
|
|
command: pacman-key --recv-keys DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A
|
|
|
|
when: '"DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A" not in pacmankeys.stdout'
|
|
|
|
|
|
|
|
- name: Trust my signing key
|
|
|
|
command: pacman-key -a -
|
|
|
|
args:
|
|
|
|
stdin: "{{ lookup('file', 'gpg.asc') }}"
|
|
|
|
when: '"B848159363C2877917954BE127DE40D9B8455C1B" not in pacmankeys.stdout'
|
|
|
|
register: my_key_imported
|
|
|
|
|
|
|
|
- name: Sign my signing key
|
|
|
|
command: pacman-key --lsign-key "B848159363C2877917954BE127DE40D9B8455C1B"
|
|
|
|
when: my_key_imported.changed
|
|
|
|
|
|
|
|
- name: Build the aurutils package
|
|
|
|
become_user: "{{ build_user.name }}"
|
|
|
|
command: makepkg -s --noconfirm
|
|
|
|
args:
|
|
|
|
chdir: "/home/{{ build_user.name }}/.config/ansible_deploy/aurutils"
|
|
|
|
creates: "/home/{{ build_user.name }}/.config/ansible_deploy/aurutils/aurutils-*-any.pkg.tar.*"
|
|
|
|
|
|
|
|
- name: Install aurutils
|
|
|
|
shell: "pacman --noconfirm -U /home/{{ build_user.name }}/.config/ansible_deploy/aurutils/aurutils-*-any.pkg.tar.*"
|
|
|
|
args:
|
|
|
|
creates: /usr/bin/aur
|
|
|
|
|
|
|
|
- name: Create owned directories
|
|
|
|
file:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ build_user.name }}"
|
|
|
|
group: "{{ build_user.group }}"
|
|
|
|
mode: 0755
|
|
|
|
loop:
|
|
|
|
- /var/cache/pacman/custom
|
|
|
|
|
|
|
|
- name: Create directories
|
|
|
|
file:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
loop:
|
|
|
|
- /etc/aurutils
|
|
|
|
|
|
|
|
- name: Install configs
|
|
|
|
copy:
|
|
|
|
src: "files/{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
loop:
|
|
|
|
- src: aurutils.conf
|
|
|
|
dest: /etc/pacman.d/conf.d/
|
|
|
|
- src: pacman-custom.conf
|
|
|
|
dest: /etc/aurutils/
|
2023-01-16 22:05:47 +00:00
|
|
|
- src: makepkg.conf # TODO: Is this needed or can I use the default from devtools?
|
2022-10-16 05:31:15 +00:00
|
|
|
dest: /etc/aurutils/
|
|
|
|
|
|
|
|
- name: Create custom repo db
|
|
|
|
command: repo-add --sign /var/cache/pacman/custom/custom.db.tar
|
|
|
|
become: true
|
|
|
|
become_user: "{{ build_user.name }}"
|
|
|
|
args:
|
|
|
|
creates: /var/cache/pacman/custom/custom.db.tar
|
|
|
|
|
|
|
|
- name: Install scripts
|
|
|
|
copy:
|
|
|
|
src: "files/{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
loop:
|
|
|
|
- src: aurutils-purge
|
|
|
|
dest: /usr/local/bin/aurutils-purge
|
|
|
|
- src: aurutils-sync
|
|
|
|
dest: /usr/local/bin/aurutils-sync
|
|
|
|
|
|
|
|
- name: build aurutils inside aurutils
|
|
|
|
become_user: "{{ build_user.name }}"
|
|
|
|
command: aurutils-sync --no-view aurutils
|
|
|
|
args:
|
|
|
|
creates: "/var/cache/pacman/custom/aurutils-*-any.pkg.tar.*"
|
|
|
|
register: buildaurutils
|
|
|
|
|
|
|
|
- name: Install aurutils
|
|
|
|
command: pacman -Syy aurutils
|
|
|
|
when: buildaurutils.changed
|
|
|
|
|
|
|
|
- name: chown the custom package db
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ build_user.name }}"
|
|
|
|
state: file
|
|
|
|
loop:
|
|
|
|
- /var/cache/pacman/custom/custom.db
|