Skip to content

Commit

Permalink
Revamp the package rebuild process as a whole
Browse files Browse the repository at this point in the history
This is much cleaner and easier to follow upon. Also has better
checks against package reinstallation process.
  • Loading branch information
kurtbahartr committed Nov 15, 2024
1 parent 18a87d4 commit 9c08418
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
32 changes: 17 additions & 15 deletions roles/ags/tasks/Archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,33 @@
- name: Build AGSv1
ansible.builtin.shell:
cmd: |
mkdir {{ ansible_user_dir }}/agsv1_rebuild
mkdir -p {{ ansible_user_dir }}/agsv1_rebuild
cd {{ ansible_user_dir }}/agsv1_rebuild
/usr/bin/curl -fsSL https://github.com/kotontrion/PKGBUILDS/raw/main/agsv1/PKGBUILD > PKGBUILD
makepkg -s
ignore_errors: yes
pkgname=$(bash -c 'source PKGBUILD && echo "${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst"')
makepkg -sC
if [ "$?" == "13" ] && [ ! -f "${pkgname}" ]; then
false
fi
register: agsv1_build_outcome
changed_when: no
when: system.ags.need_v1 is defined and system.ags.need_v1
changed_when: "'Finished making' in agsv1_build_outcome.stdout"

- name: Install Rebuilt AGSv1
ansible.builtin.shell:
cmd: "pacman -U --noconfirm {{ ansible_user_dir }}/agsv1_rebuild/agsv1-1.9.0-1-x86_64.pkg.tar.zst"
become: true
register: agsv1_install_outcome

rescue:
- name: Uninstall Existing AGS
community.general.pacman:
name: aylurs-gtk-shell-git
name: "{{ item }}"
state: absent
become: true
register: agsv2_uninstall_outcome
loop:
- aylurs-gtk-shell
- aylurs-gtk-shell-git

- name: Install Rebuilt AGSv1
- name: Install Built AGSv1
ansible.builtin.shell:
cmd: "pacman -U --noconfirm {{ ansible_user_dir }}/agsv1_rebuild/agsv1-1.9.0-1-x86_64.pkg.tar.zst"
cmd: |
cd {{ ansible_user_dir }}/agsv1_rebuild
pkgname=$(bash -c 'source PKGBUILD && echo "${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst"')
pacman -U --noconfirm {{ ansible_user_dir }}/agsv1_rebuild/${pkgname}
become: true
register: agsv1_install_outcome
changed_when: "'is up to date' not in agsv1_install_outcome.stderr"
24 changes: 17 additions & 7 deletions roles/hyprland/tasks/Archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,39 @@
- hyprsunset-git

- name: Test Hyprpm After Installation and Rebuild If Necessary
when:
- system.hyprland.plugins.rebuild_hypr_on_failure.enabled is defined
- system.hyprland.plugins.rebuild_hypr_on_failure.enabled
- system.hyprland.plugins.rebuild_hypr_on_failure.pkgbuild_url is defined
- "'PKGBUILD' in system.hyprland.plugins.rebuild_hypr_on_failure.pkgbuild_url"
block:
- name: Update hyprpm package list
command: hyprpm update
when: system.hyprland.plugins.rebuild_hypr_on_failure.enabled and system.hyprland.plugins.rebuild_hypr_on_failure.pkgbuild_url is defined
changed_when: no

rescue:
- name: Rebuild Hyprland
ansible.builtin.shell:
cmd: |
mkdir {{ ansible_user_dir }}/hyprland_rebuild
mkdir -p {{ ansible_user_dir }}/hyprland_rebuild
cd {{ ansible_user_dir }}/hyprland_rebuild
/usr/bin/curl -fsSL {{ system.hyprland.plugins.rebuild_hypr_on_failure.pkgbuild_url }} > PKGBUILD
makepkg -s
ignore_errors: yes
pkgname=$(bash -c 'source PKGBUILD && echo "${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst"')
makepkg -sC
if [ "$?" == "13" ] && [ ! -f "${pkgname}" ]; then
false
fi
register: hyprland_rebuild_outcome
changed_when: no
changed_when: "'Finished making' in hyprland_rebuild_outcome.stdout"

- name: Install rebuilt Hyprland
- name: Install Rebuilt Hyprland
ansible.builtin.shell:
cmd: "pacman -U --noconfirm {{ ansible_user_dir }}/hyprland_rebuild/hyprland-0.*-x86_64.pkg.tar.zst"
cmd: |
pkgname=$(bash -c 'source PKGBUILD && echo "${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst"')
pacman -U --noconfirm {{ ansible_user_dir }}/hyprland_rebuild/${pkgname}
become: true
register: hyprland_reinstall_outcome
changed_when: "'is up to date' not in hyprland_reinstall_outcome.stderr"

always:
- name: Update hyprpm package list
Expand Down

0 comments on commit 9c08418

Please sign in to comment.