refactor(os): Allow AUR helper to replace itself (#3)

This commit is contained in:
hygienic-books 2023-10-20 16:30:29 +02:00
parent 66eb02ff7d
commit 148f930636
2 changed files with 42 additions and 2 deletions

View File

@ -109,7 +109,7 @@ After installation you're going to want to at least touch these points in your n
- Passwords
- ZFS: The password for all datasets underneath `zpool` is `password`.
- Local `root` account: The local `root` account's password is `password`.
- Arch User Repository (AUR) helper: We installed [paru](https://github.com/Morganamilo/paru) as our AUR helper, we installed from GitHub via `makepkg -si`.
- Arch User Repository (AUR) helper: We installed [paru](https://github.com/Morganamilo/paru) as our AUR helper, we installed from GitHub via `makepkg -si` then replaced itself with its [paru-bin](https://aur.archlinux.org/packages/paru-bin) version from AUR.
- In `/etc/systemd/network/50-wired.network` instead of a DHCP-based network config you can get a static one. The DHCP-based one for reference looks like:
```
...

View File

@ -460,7 +460,46 @@ function get_aur_helper () {
}
function paru_install () {
sudo --user build paru -S --noconfirm "${@}"
declare -a paru_install_packages
[[ "${1}" ]] && while :; do
case "${1}" in
-[[:alnum:]]*)
printf -- '%s\n' \
'Short-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
exit 77
;;
--replace-conflicting)
pacman_force_yes='true'
shift
continue
;;
--*)
printf -- '%s\n' \
'Long-form argument '"'${1}'"' not supported for function '"'${FUNCNAME[0]}()'"'. Only known accepted argument' \
'is '"'"'--replace-conflicting'"'"' without a value given. Exiting ...'
exit 77
;;
'')
# All arguments processed
break
;;
*)
paru_install_packages+=("${1}")
shift
;;
esac
done || {
printf -- '%s\n' \
'No argument '"'${1}'"' given for function '"'${FUNCNAME[0]}'"'. Exiting ...'
exit 77
}
if [[ "${pacman_force_yes}" ]]; then
yes 'y' | sudo --user build paru -S "${paru_install_packages[@]}"
unset -v pacman_force_yes
else
sudo --user build paru -S --noconfirm "${paru_install_packages[@]}"
fi
}
function keep_initiramfs_root_only_rw () {
@ -525,6 +564,7 @@ function install_os_in_chroot () {
unleash_makepkg
add_motd_getting_started_msg
get_aur_helper
paru_install --replace-conflicting 'paru-bin'
paru_install 'zfs-dkms' 'zfs-utils'
hwclock --systohc
locale-gen