From cd83fd59f6eab2b97bbe802440cf56cb0b5dc343 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sat, 15 Oct 2022 12:41:58 -0700 Subject: [PATCH] Import key when expired --- installer | 79 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/installer b/installer index ff40a10..6321865 100755 --- a/installer +++ b/installer @@ -6,7 +6,7 @@ # AIF, Calamares, and the Arch Wiki.. Credit where credit is due # shellcheck disable=2086,2046,2254,2164,2030,2031,2001 -VER=2.23 +VER=2.24 # default values { @@ -1603,6 +1603,9 @@ install_main() errshow 0 "chrun '$USERCMD'" fi + # reset the signature check in pacman.conf + # tr '\n' '\a' < "$MNT/etc/pacman.conf" | sed 's/\(\[archlabs]\).*SigLevel = Optional TrustAll/\1/' | tr '\a' '\n' + while :; do dlg choice menu "Finalization" "$_edit" \ finished "exit the installer and reboot" \ @@ -1774,7 +1777,35 @@ install_user() # upgrade existing home with new skeleton configs, making backups when needed (( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER" - install_cleanup "$NEWUSER" + + # cleanup the new home folder + + # remove tint2 configs if bspwm and openbox aren't being installed + [[ $INSTALL_WMS =~ (bspwm|openbox) ]] || rm -rf "$MNT/home/$NEWUSER/.config/tint2" + + # remove jgmenu configs if bspwm, fluxbox, and openbox aren't being installed + [[ $INSTALL_WMS =~ (fluxbox|bspwm|openbox) ]] || rm -rf "$MNT/home/$NEWUSER/.config/jgmenu" + + # remove geany configs if it wasn't installed + [[ ${USER_PKGS[*]} != *geany* ]] && rm -rf "$MNT/home/$NEWUSER/.config/geany" + + # remove shell stuff for unused shells + [[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$NEWUSER/.bash"* + [[ $NEWSHELL != 'zsh' ]] && rm -rf "$MNT/home/$NEWUSER/.z"* + + cat >> "$MNT/etc/profile" <<- EOF + # add ~/.local/bin to the PATH + echo \$PATH | grep -q "/home/$NEWUSER/.local/bin:" || export PATH="/home/$NEWUSER/.local/bin:\$PATH" + EOF + + # failed to install some AL packages so put a list in a script for the user to install later + if [[ "${FAIL_PKG[*]}" ]]; then + cat > "$MNT/home/$NEWUSER/packages" <<- EOF + #!/bin/bash + sudo pacman -Syyu ${FAIL_PKG[*]} --needed --noconfirm || exit + rm -f /home/$NEWUSER/packages" + EOF + fi } install_login() @@ -1797,40 +1828,6 @@ install_login() config_${LOGIN_TYPE} } -install_cleanup() -{ - local user="$1" - - # remove tint2 configs if bspwm and openbox aren't being installed - [[ $INSTALL_WMS =~ (bspwm|openbox) ]] || rm -rf "$MNT/home/$user/.config/tint2" - - # remove jgmenu configs if bspwm, fluxbox, and openbox aren't being installed - [[ $INSTALL_WMS =~ (fluxbox|bspwm|openbox) ]] || rm -rf "$MNT/home/$user/.config/jgmenu" - - # remove geany configs if it wasn't installed - [[ ${USER_PKGS[*]} != *geany* ]] && rm -rf "$MNT/home/$user/.config/geany" - - # remove shell stuff for unused shells - [[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$user/.bash"* - [[ $NEWSHELL != 'zsh' ]] && rm -rf "$MNT/home/$user/.z"* - - cat >> "$MNT/etc/profile" <<- EOF - # add ~/.local/bin to the PATH - echo \$PATH | grep -q "/home/$user/.local/bin:" || export PATH="/home/$user/.local/bin:\$PATH" - EOF - - # failed to install some AL packages so put a list in a script for the user to install later - if [[ "${FAIL_PKG[*]}" ]]; then - cat > "$MNT/home/$user/packages" <<- EOF - #!/bin/bash - sudo pacman -Syyu ${FAIL_PKG[*]} --needed --noconfirm || exit - rm -f /home/$user/packages" - EOF - fi - - return 0 -} - install_bootldr() { local uuid_type="UUID" url='' @@ -2035,7 +2032,7 @@ install_check_bg() al_repo "$MNT/etc/pacman.conf" { chrun "pacman -Syyu --noconfirm" - if ! pacman-key --list-keys | grep -q "$key"; then + if pacman-key --list-keys | grep -q "expired.*Nathaniel Maia" || ! pacman-key --list-keys | grep -q "$key"; then chrun "pacman-key --recv-keys '$key'" chrun "pacman-key --finger '$key'" chrun "pacman-key --lsign-key '$key'" @@ -2156,7 +2153,7 @@ install_background() al_repo "$MNT/etc/pacman.conf" { chrun "pacman -Syyu --noconfirm" - if ! pacman-key --list-keys | grep -q "$key"; then + if pacman-key --list-keys | grep -q "expired.*Nathaniel Maia" || ! pacman-key --list-keys | grep -q "$key"; then chrun "pacman-key --recv-keys '$key'" chrun "pacman-key --finger '$key'" chrun "pacman-key --lsign-key '$key'" @@ -3212,7 +3209,11 @@ al_repo() { local conf="$1" - grep -q '[archlabs]' "$conf" 2> /dev/null && return 0 + # disable the signature check for AL repo in pacman.conf + # [[ $(tr '\n' '\a' < "$conf" | grep -o '\[archlabs].*SigLevel = Optional TrustAll' | tr '\a' '\n') ]] && return 0 + # SigLevel = Optional TrustAll + + grep -q '\[archlabs]' "$conf" 2> /dev/null && return 0 if ! grep -q 'ILoveCandy' "$conf" 2> /dev/null; then sed -i 's/^#Color/Color/' "$conf"