feat: install AUR packages

This commit is contained in:
Matthieu Bessat 2024-05-27 01:25:03 +02:00
parent a0ea7b0a3f
commit 003a22ca6e
6 changed files with 49 additions and 9 deletions

View file

@ -0,0 +1 @@
makepkg_aur_url: https://aur.archlinux.org/cgit/aur.git/snapshot/

View file

@ -0,0 +1,35 @@
# Inputs:
# package_name: name of the package to download and build (i.e. yay-bin)
# build_user: user we will sudo to when building. Must be able to use
# passwordless sudo
- name: Check if package {{ package_name }} is already installed
shell: set -o pipefail || exit 1; pacman -Qsq |
{ grep '^'{{ package_name | quote }}'$' ; [ $? -lt 2 ]; }
register: _package_installed
changed_when: no
- name: Make and install {{ package_name }}
become: yes
become_user: "aur_builder"
when: _package_installed.stdout == ""
block:
- name: Create temporary build directory
tempfile:
state: directory
register: _tempdir
- name: Download package from the AUR
unarchive:
remote_src: yes
src: "{{ makepkg_aur_url }}{{ package_name }}.tar.gz"
dest: "{{ _tempdir.path }}"
- name: Run makepkg
shell: cd '{{ _tempdir.path | quote }}/{{ package_name | quote }}' && makepkg -rsi --noconfirm
always:
- name: Remove temporary build directory
file:
state: absent
path: "{{ _tempdir.path }}"

View file

@ -0,0 +1,5 @@
- name: Run the installation backend
include_tasks: backend-makepkg.yaml
loop: "{{ packages }}"
loop_control:
loop_var: package_name