Tweaks for arch iso install and keyring

This commit is contained in:
natemaia 2021-09-05 13:39:39 -07:00
parent 55a944f078
commit d506b2a1f5

310
installer
View File

@ -6,7 +6,7 @@
# AIF, Calamares, and the Arch Wiki.. Credit where credit is due
# shellcheck disable=SC2086,SC2046,SC2254,SC2164
VER=2.8
VER=2.10
# default values {
@ -653,22 +653,27 @@ select_keymap()
{
if [[ ! -f /tmp/xkeys ]]; then
dlg KEYMAP menu "Keyboard" "$_keymap" \
af Afghani al Albanian am Armenian ara Arabic at German au English \
az Azerbaijani ba Bosnian bd Bangla be Belgian 'bg' Bulgarian br Portuguese \
bt Dzongkha bw Tswana by Belarusian ca French 'cd' French ch German \
cm English cn Chinese cz Czech de German dk Danish dz Berber \
ee Estonian epo Esperanto es Spanish et Amharic 'fi' Finnish fo Faroese \
fr French gb English ge Georgian gh English gn French gr Greek \
hr Croatian hu Hungarian id Indonesian ie Irish il Hebrew 'in' Indian \
iq Iraqi ir Persian is Icelandic it Italian jp Japanese ke Swahili \
kg Kyrgyz kh Khmer kr Korean kz Kazakh la Lao latam Spanish \
lk Sinhala lt Lithuanian lv Latvian ma Arabic mao Maori md Moldavian \
me Montenegrin mk Macedonian ml Bambara mm Burmese mn Mongolian mt Maltese \
'mv' Dhivehi my Malay ng English nl Dutch no Norwegian np Nepali \
ph Filipino pk Urdu pl Polish pt Portuguese ro Romanian rs Serbian \
ru Russian se Swedish si Slovenian sk Slovak sn Wolof sy Arabic \
tg French th Thai tj Tajik tm Turkmen tr Turkish tw Taiwanese \
tz Swahili ua Ukrainian us English uz Uzbek vn Vietnamese za English || return 1
us English af Afghani al Albanian am Armenian ara Arabic \
at German au English az Azerbaijani ba Bosnian bd Bangla \
be Belgian 'bg' Bulgarian br Portuguese bt Dzongkha bw Tswana \
by Belarusian ca French 'cd' French ch German cm English \
cn Chinese cz Czech de German dk Danish dz Berber \
ee Estonian epo Esperanto es Spanish et Amharic 'fi' Finnish \
fo Faroese fr French gb English ge Georgian gh English \
gn French gr Greek hr Croatian hu Hungarian id Indonesian \
ie Irish il Hebrew 'in' Indian iq Iraqi ir Persian \
is Icelandic it Italian jp Japanese ke Swahili kg Kyrgyz \
kh Khmer kr Korean kz Kazakh la Lao latam Spanish \
lk Sinhala lt Lithuanian lv Latvian ma Arabic mao Maori \
md Moldavian me Montenegrin mk Macedonian ml Bambara mm Burmese \
mn Mongolian mt Maltese mv Dhivehi my Malay ng English \
nl Dutch no Norwegian np Nepali ph Filipino pk Urdu \
pl Polish pt Portuguese ro Romanian rs Serbian ru Russian \
se Swedish si Slovenian sk Slovak sn Wolof sy Arabic \
tg French th Thai tj Tajik tm Turkmen tr Turkish \
tw Taiwanese tz Swahili ua Ukrainian uz Uzbek vn Vietnamese \
za English \
|| return 1
echo "$KEYMAP" > /tmp/xkeys
else
@ -1081,6 +1086,7 @@ part_auto()
parted -s "$device" mkpart "$boot_type" "$boot_fs" 1MiB 513MiB > /dev/null 2> "$ERR"
errshow 0 "parted -s '$device' mkpart '$boot_type' '$boot_fs' 1MiB 513MiB > /dev/null" || return 1
sleep 0.5
BOOT_D="$device"
AUTO_BOOT=$(lsblk -lno NAME,TYPE "$device" | awk 'NR==2 {print "/dev/" $1}')
@ -1741,10 +1747,11 @@ install_base()
if [[ $DIST == "ArchLabs" ]]; then
# we have some customizations in /etc on the iso we want to preserve
cp -vf /etc/pacman.conf "$MNT/etc/"
cp -vf /etc/os-release "$MNT/etc/"
cp -vf /etc/modprobe.d/* "$MNT/etc/modprobe.d/" # */
cp -vf /etc/X11/xorg.conf.d/* "$MNT/etc/X11/xorg.conf.d/" # */
cp -vf /etc/os-release "$MNT/etc/os-release"
cp -vf /etc/skel/.zshrc "$MNT/etc/skel/.zshrc"
else
zshrc
fi
# copy network settings
@ -1762,6 +1769,45 @@ install_base()
chrun "locale-gen"
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
# touchpad config
cat > "$MNT/etc/X11/xorg.conf.d/40-touchpad.conf" <<- EOF
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingDrag" "on"
Option "AccelSpeed" "0.7"
Option "AccelProfile" "adaptive"
Option "ScrollMethod" "twofinger"
Option "MiddleEmulation" "on"
Option "DisableWhileTyping" "on"
Option "TappingButtonMap" "lrm"
EndSection
Section "InputClass"
Identifier "touchpad-ignore-duplicates"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/mouse*"
Option "Ignore" "on"
EndSection
Section "InputClass"
Identifier "clickpad-buttons"
MatchDriver "libinput"
Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%"
EndSection
Section "InputClass"
Identifier "Disable-clickpad-buttons-on-Apple-touchpads"
MatchProduct "Apple|bcm5974"
MatchDriver "libinput"
Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection
EOF
cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF
# Use localectl(1) to instruct systemd-localed to update it.
Section "InputClass"
@ -2201,7 +2247,7 @@ install_mirrorlist()
install_background()
{
local luks='' net='networkmanager'
local luks='' net='networkmanager' key="9E4F11C6A072942A7B3FD3B0B81EB14A09A25EB0"
[[ ! -d /etc/NetworkManager/system-connections ]] && net='netctl'
[[ $LUKS ]] && luks='cryptsetup'
@ -2216,10 +2262,17 @@ install_background()
cp -Rf /etc/pacman.d "$MNT/etc/"
cp -f /etc/pacman.conf "$MNT/etc/"
cp -f /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/"
al_repo "$MNT/etc/pacman.conf" || chrun "pacman -Syyu --noconfirm" >> /tmp/bgout 2>&1
chrun "pacman -S archlinux-keyring --noconfirm" >> /tmp/bgout 2>&1
chrun "pacman -S ${ISO_PKGS[*]} $net $luks --noconfirm --needed" >> /tmp/bgout 2>&1
al_repo "$MNT/etc/pacman.conf"
{
chrun "pacman -Syyu --noconfirm"
if ! 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'"
fi
chrun "pacman -S archlinux-keyring archlabs-keyring --noconfirm"
chrun "pacman -S ${ISO_PKGS[*]} $net $luks --noconfirm --needed"
} >> /tmp/bgout 2>&1
if [[ $net == "networkmanager" ]]; then
chrun 'systemctl enable NetworkManager.service' >> /tmp/bgout 2>&1
@ -3176,6 +3229,206 @@ chrun()
arch-chroot "$MNT" bash -c "$1"
}
zshrc()
{
cat > "$MNT/etc/skel/.zshrc" <<- EOF
if [[ \$- != *i* ]]; then
return
fi
# completion cache path setup
typeset -g comppath="\$HOME/.cache"
typeset -g compfile="\$comppath/.zcompdump"
if [[ -d "\$comppath" ]]; then
[[ -w "\$compfile" ]] || rm -rf "\$compfile" >/dev/null 2>&1
else
mkdir -p "\$comppath"
fi
# zsh internal stuff
SHELL=\$(which zsh || echo '/bin/zsh')
KEYTIMEOUT=1
SAVEHIST=10000
HISTSIZE=10000
HISTFILE="\$HOME/.cache/.zsh_history"
alias la='ls -Ah'
alias ll='ls -lAh'
alias grep='grep --color=auto'
alias grub-update='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias mirror-update='sudo reflector --verbose --score 100 -l 50 -f 10 --sort rate --save /etc/pacman.d/mirrorlist'
ls() # ls with preferred arguments
{
command ls --color=auto -F1 "\$@"
}
cd() # cd and ls after
{
builtin cd "\$@" && command ls --color=auto -F
}
src() # recompile completion and reload zsh
{
autoload -U zrecompile
rm -rf "\$compfile"*
compinit -u -d "\$compfile"
zrecompile -p "\$compfile"
exec zsh
}
# less/manpager colours
export MANWIDTH=80
export LESS='-R'
export LESSHISTFILE=-
export LESS_TERMCAP_me=$'\\e[0m'
export LESS_TERMCAP_se=$'\\e[0m'
export LESS_TERMCAP_ue=$'\\e[0m'
export LESS_TERMCAP_us=$'\\e[32m'
export LESS_TERMCAP_mb=$'\\e[31m'
export LESS_TERMCAP_md=$'\\e[31m'
export LESS_TERMCAP_so=$'\\e[47;30m'
export LESSPROMPT='?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...'
# completion
setopt CORRECT
setopt NO_NOMATCH
setopt LIST_PACKED
setopt ALWAYS_TO_END
setopt GLOB_COMPLETE
setopt COMPLETE_ALIASES
setopt COMPLETE_IN_WORD
# builtin command behaviour
setopt AUTO_CD
# job control
setopt AUTO_CONTINUE
setopt LONG_LIST_JOBS
# history control
setopt HIST_VERIFY
setopt SHARE_HISTORY
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
# misc
setopt EXTENDED_GLOB
setopt TRANSIENT_RPROMPT
setopt INTERACTIVE_COMMENTS
autoload -U compinit # completion
autoload -U terminfo # terminfo keys
zmodload -i zsh/complist # menu completion
autoload -U promptinit # prompt
# better history navigation, matching currently typed text
autoload -U up-line-or-beginning-search; zle -N up-line-or-beginning-search
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
# set the terminal mode when entering or exiting zle, otherwise terminfo keys are not loaded
if (( \${+terminfo[smkx]} && \${+terminfo[rmkx]} )); then
zle-line-init() { echoti smkx; }; zle -N zle-line-init
zle-line-finish() { echoti rmkx; }; zle -N zle-line-finish
fi
exp_alias() # expand aliases to the left (if any) before inserting the key pressed
{
zle _expand_alias
zle self-insert
}; zle -N exp_alias
# bind keys not in terminfo
bindkey -- ' ' exp_alias
bindkey -- '^P' up-history
bindkey -- '^N' down-history
bindkey -- '^E' end-of-line
bindkey -- '^A' beginning-of-line
bindkey -- '^[^M' self-insert-unmeta # alt-enter to insert a newline/carriage return
bindkey -- '^[05M' accept-line # fix for enter key on some systems
# default shell behaviour using terminfo keys
[[ -n \${terminfo[kdch1]} ]] && bindkey -- "\${terminfo[kdch1]}" delete-char # delete
[[ -n \${terminfo[kend]} ]] && bindkey -- "\${terminfo[kend]}" end-of-line # end
[[ -n \${terminfo[kcuf1]} ]] && bindkey -- "\${terminfo[kcuf1]}" forward-char # right arrow
[[ -n \${terminfo[kcub1]} ]] && bindkey -- "\${terminfo[kcub1]}" backward-char # left arrow
[[ -n \${terminfo[kich1]} ]] && bindkey -- "\${terminfo[kich1]}" overwrite-mode # insert
[[ -n \${terminfo[khome]} ]] && bindkey -- "\${terminfo[khome]}" beginning-of-line # home
[[ -n \${terminfo[kbs]} ]] && bindkey -- "\${terminfo[kbs]}" backward-delete-char # backspace
[[ -n \${terminfo[kcbt]} ]] && bindkey -- "\${terminfo[kcbt]}" reverse-menu-complete # shift-tab
[[ -n \${terminfo[kcuu1]} ]] && bindkey -- "\${terminfo[kcuu1]}" up-line-or-beginning-search # up arrow
[[ -n \${terminfo[kcud1]} ]] && bindkey -- "\${terminfo[kcud1]}" down-line-or-beginning-search # down arrow
# correction
zstyle ':completion:*:correct:*' original true
zstyle ':completion:*:correct:*' insert-unambiguous true
zstyle ':completion:*:approximate:*' max-errors 'reply=(\$(( (\$#PREFIX + \$#SUFFIX) / 3 )) numeric)'
# completion
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "\$comppath"
zstyle ':completion:*' rehash true
zstyle ':completion:*' verbose true
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:-command-:*:' verbose false
zstyle ':completion::complete:*' gain-privileges 1
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*' completer _complete _match _approximate _ignored
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# labels and categories
zstyle ':completion:*' group-name ''
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*' format ' %F{green}->%F{yellow} %d%f'
zstyle ':completion:*:messages' format ' %F{green}->%F{purple} %d%f'
zstyle ':completion:*:descriptions' format ' %F{green}->%F{yellow} %d%f'
zstyle ':completion:*:warnings' format ' %F{green}->%F{red} no matches%f'
zstyle ':completion:*:corrections' format ' %F{green}->%F{green} %d: %e%f'
# menu colours
eval "\$(dircolors)"
zstyle ':completion:*' list-colors \${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=36=0=01'
# command parameters
zstyle ':completion:*:functions' ignored-patterns '(prompt*|_*|*precmd*|*preexec*)'
zstyle ':completion::*:(-command-|export):*' fake-parameters \${\${\${_comps[(I)-value-*]#*,}%%,*}:#-*-}
zstyle ':completion:*:*:*:*:processes' command "ps -u \$USER -o pid,user,comm -w -w"
zstyle ':completion:*:processes-names' command 'ps c -u \${USER} -o command | uniq'
zstyle ':completion:*:(vim|nvim|vi|nano):*' ignored-patterns '*.(wav|mp3|flac|ogg|mp4|avi|mkv|iso|so|o|7z|zip|tar|gz|bz2|rar|deb|pkg|gzip|pdf|png|jpeg|jpg|gif)'
# hostnames and addresses
zstyle ':completion:*:ssh:*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
zstyle ':completion:*:ssh:*' group-order users hosts-domain hosts-host users hosts-ipaddr
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*'
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
zstyle -e ':completion:*:hosts' hosts 'reply=( \${=\${=\${=\${\${(f)"\$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ } \${=\${(f)"\$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*} \${=\${\${\${\${(@M)\${(f)"\$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}})'
ttyctl -f
# initialize completion
compinit -u -d "\$compfile"
# initialize prompt with a decent built-in theme
promptinit
prompt adam1
EOF
}
debug()
{
export PS4='| ${BASH_SOURCE} LINE:${LINENO} FUNC:${FUNCNAME[0]:+ ${FUNCNAME[0]}()} |> '
@ -3200,10 +3453,15 @@ al_repo()
grep -q 'archlabs_repo' "$conf" 2> /dev/null && return 0
if ! grep -q 'ILoveCandy' "$conf" 2> /dev/null; then
sed -i 's/^#Color/Color/' "$conf"
sed -i '/^Color/a ILoveCandy' "$conf"
fi
cat >> "$conf" <<- EOF
[archlabs_unstable]
Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch
# [archlabs_unstable]
# Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch
[archlabs_repo]
Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch