feat: install AUR packages
This commit is contained in:
parent
a0ea7b0a3f
commit
003a22ca6e
6 changed files with 49 additions and 9 deletions
1
ansible/roles/aur/defaults/main.yaml
Normal file
1
ansible/roles/aur/defaults/main.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
makepkg_aur_url: https://aur.archlinux.org/cgit/aur.git/snapshot/
|
||||
35
ansible/roles/aur/tasks/backend-makepkg.yaml
Normal file
35
ansible/roles/aur/tasks/backend-makepkg.yaml
Normal 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 }}"
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
- name: Run the installation backend
|
||||
include_tasks: backend-makepkg.yaml
|
||||
loop: "{{ packages }}"
|
||||
loop_control:
|
||||
loop_var: package_name
|
||||
Loading…
Add table
Add a link
Reference in a new issue