diff options
Diffstat (limited to 'bin/refresh-keyring')
-rwxr-xr-x | bin/refresh-keyring | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/bin/refresh-keyring b/bin/refresh-keyring index 880364b..b807bf9 100755 --- a/bin/refresh-keyring +++ b/bin/refresh-keyring @@ -1,13 +1,26 @@ #!/bin/bash +readonly PACMAN_GNUPG_BACKUP_DIR=/etc/pacman.d.gnupg-backup-$(date '+%s') -pacman -Sy --noconfirm archlinux-keyring \ - archlinux32-keyring \ - archlinuxarm-keyring \ - parabola-keyring && \ -pacman-key --init && \ -pacman-key --populate archlinux \ - archlinux32 \ - archlinuxarm \ - parabola && \ -pacman-key --refresh-keys + +mv /etc/pacman.d/gnupg $PACMAN_GNUPG_BACKUP_DIR 2> /dev/null +if sudo pacman -Scc && + sudo pacman -Syy --noconfirm archlinux-keyring \ + archlinux32-keyring \ + archlinuxarm-keyring \ + parabola-keyring && + sudo pacman-key --init && + sudo pacman-key --populate archlinux \ + archlinux32 \ + archlinuxarm \ + parabola && + sudo pacman-key --refresh-keys +then echo "the parabola keyring has been refreshed" + rm -rf $PACMAN_GNUPG_BACKUP_DIR +else echo "there was a problem refreshing the parabola keyring" + if [ -d "$PACMAN_GNUPG_BACKUP_DIR" ] + then rm -rf /etc/pacman.d/gnupg 2> /dev/null + mv $PACMAN_GNUPG_BACKUP_DIR /etc/pacman.d/gnupg + else echo "/etc/pacman.d/gnupg is locked" + fi +fi |