summarylogtreecommitdiffstats
path: root/aurto.install
diff options
context:
space:
mode:
Diffstat (limited to 'aurto.install')
-rw-r--r--aurto.install75
1 files changed, 2 insertions, 73 deletions
diff --git a/aurto.install b/aurto.install
index f991b5cfe533..f4a4818c4d6a 100644
--- a/aurto.install
+++ b/aurto.install
@@ -1,78 +1,7 @@
#!/usr/bin/env bash
-
set -eu
-user="${SUDO_USER:-$USER}"
-
-function initialised {
- grep -q '^Include = /etc/pacman.d/aurto$' /etc/pacman.conf
-}
-
-post_install() {
- if initialised; then
- echo 'Already initialised' >&2
- exit 0
- fi
-
- echo "aurto: Initialising for user: $user"
- echo "$user" > /usr/lib/aurto/user
- chmod 700 /usr/lib/aurto/user
-
- install -d /var/cache/pacman/aurto -o "$user"
- sudo -u "$user" repo-add /var/cache/pacman/aurto/aurto.db.tar 2>/dev/null
-
- echo 'aurto: Adding include /etc/pacman.d/aurto >> pacman.conf' >&2
- if ! test -f /etc/pacman.conf.aurto-backup; then
- cp /etc/pacman.conf /etc/pacman.conf.aurto-backup
- fi
- echo -e "# aurto repo\\nInclude = /etc/pacman.d/aurto" >> /etc/pacman.conf
-
- if ! test -f /etc/aurto/trusted-users; then
- echo 'aurto: Adding default trusted users -> /etc/aurto/trusted-users' >&2
- install -Dm640 -o "$user" /usr/lib/aurto/default-trusted-users.txt /etc/aurto/trusted-users
- fi
-
- echo 'aurto: Adding & enabling systemd timer update tasks' >&2
- systemctl enable --now /usr/lib/systemd/system/check-aurto-git-trigger.timer
- systemctl enable --now /usr/lib/systemd/system/update-aurto.timer
- systemctl enable /usr/lib/systemd/system/update-aurto-startup.timer
-
- echo "aurto: Passwordless usage available for \`wheel\` group"
-}
-
-post_upgrade() {
- old_version=$2
- update_from_before_0_7_8_1=$(vercmp "$old_version" "0.7.8-1")
- if [ "$update_from_before_0_7_8_1" = "-1" ] \
- && ! systemctl is-enabled /usr/lib/systemd/system/update-aurto-startup.timer 2>/dev/null
- then
- systemctl enable /usr/lib/systemd/system/update-aurto-startup.timer
- fi
-}
pre_remove() {
- if ! initialised; then
- exit 0
- fi
-
- echo 'aurto: Removing systemd timer update tasks' >&2
- systemctl disable --now check-aurto-git-trigger.timer || true
- systemctl disable --now update-aurto.timer || true
- systemctl disable update-aurto-startup.timer || true
-}
-
-post_remove() {
- if ! initialised; then
- exit 0
- fi
-
- echo 'aurto: Removing include from pacman.conf' >&2
- sed -i '/^Include = \/etc\/pacman.d\/aurto$/d' /etc/pacman.conf
- sed -i '/^# aurto repo$/d' /etc/pacman.conf
-
- echo 'aurto: Removing /var/cache/pacman/aurto' >&2
- rm -rf /var/cache/pacman/aurto 2>/dev/null || true
-
- rm -f /usr/lib/aurto/user 2>/dev/null || true
- rm -f /etc/aurto/trusted-users 2>/dev/null || true
- rm -d /etc/aurto 2>/dev/null || true
+ # aurto self cleanup
+ /usr/lib/aurto/install remove
}