Skip to content

Commit ffba976

Browse files
committed
Refresh keyring before using pacman
1 parent 9941625 commit ffba976

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

alez.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,27 @@ fetch_archzfs_key() {
433433
return 1
434434
}
435435

436+
init_keyring() {
437+
declare -a keyservers=(
438+
'hkp://pool.sks-keyservers.net:80'
439+
# 'hkp://pgp.mit.edu:80' # Replace with working keyservers
440+
# 'hkp://ipv4.pool.sks-keyservers.net:80'
441+
)
442+
443+
pacman-key --init &> /dev/null
444+
445+
{
446+
# Try default keyserver first
447+
pacman-key --refresh-keys && return 0
448+
for ks in "${keyservers[@]}"; do
449+
pacman-key --refresh-keys --keyserver "${ks}" && return 0
450+
done
451+
} &>/dev/null
452+
453+
return 1
454+
}
455+
456+
436457
## MAIN ##
437458

438459
trap error_cleanup ERR # Run on error
@@ -670,6 +691,12 @@ fi
670691

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

694+
if ! init_keyring; then
695+
dialog --title "Installation error" \
696+
--msgbox "ERROR: Failed to initialize keyring" ${HEIGHT} ${WIDTH}
697+
exit 1
698+
fi
699+
673700
refresh_mirrors
674701

675702
if ! fetch_archzfs_key; then

0 commit comments

Comments
 (0)