Skip to content

Commit

Permalink
Refresh keyring before using pacman
Browse files Browse the repository at this point in the history
  • Loading branch information
johnramsden committed May 17, 2020
1 parent 9941625 commit ffba976
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions alez.sh
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,27 @@ fetch_archzfs_key() {
return 1
}

init_keyring() {
declare -a keyservers=(
'hkp://pool.sks-keyservers.net:80'
# 'hkp://pgp.mit.edu:80' # Replace with working keyservers
# 'hkp://ipv4.pool.sks-keyservers.net:80'
)

pacman-key --init &> /dev/null

{
# Try default keyserver first
pacman-key --refresh-keys && return 0
for ks in "${keyservers[@]}"; do
pacman-key --refresh-keys --keyserver "${ks}" && return 0
done
} &>/dev/null

return 1
}


## MAIN ##

trap error_cleanup ERR # Run on error
Expand Down Expand Up @@ -670,6 +691,12 @@ fi

dialog --title "Begin install?" --msgbox "Setup complete, begin install?" ${HEIGHT} ${WIDTH}

if ! init_keyring; then
dialog --title "Installation error" \
--msgbox "ERROR: Failed to initialize keyring" ${HEIGHT} ${WIDTH}
exit 1
fi

refresh_mirrors

if ! fetch_archzfs_key; then
Expand Down

0 comments on commit ffba976

Please sign in to comment.