From 391ffe388cdee37383152051fdecec5cb4ce4044 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 14 Aug 2018 21:03:35 -0400 Subject: update refresh-keyring script --- bin/refresh-keyring | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'bin') 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 -- cgit v1.2.2