Use pamac instead of yay.

Yay has been acting out when running it in a script.
This commit is contained in:
dabruh 2022-05-28 22:43:08 +02:00
parent 0d0adbd3e1
commit 223ff60a0c
2 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,3 @@
pacman-any:code,feh,i3exit,i3status,network-manager-applet,pasystray,vim,xautolock,xss-lock,yay
pacman-any:code,feh,i3exit,i3status,network-manager-applet,pasystray,vim,xautolock,xss-lock,noto-fonts-emoji
pacman-laptop:brightnessctl
aur-any:picom-git,flashfocus-git,sddm-theme-aerial-git

View File

@ -44,9 +44,6 @@ while getopts ":uh" arg; do
esac
done
YAY_ARGS="--aur --answerdiff NotInstalled --answeredit None --answerclean All --answerupgrade None"
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
# Returns a comma-separated list of packages for one or more targets.
# The packages file may contain multiple rows with the same target name.
function get_packages() {
@ -82,20 +79,25 @@ function configure_sddm() {
} | sudo tee "$sddm_config_dir/xsetup" >/dev/null
}
function prepare_arch() {
which pamac >/dev/null && return 0
sudo pacman -S pamac --noconfirm || return 1
}
function setup_arch_with_pamac() {
local targets=("pacman-any") packages
is_laptop && targets+=("pacman-laptop")
packages="$(get_packages "${targets[@]}")"
# shellcheck disable=SC2086
sudo pamac install --no-confirm $packages || return 1
sudo pamac install $packages --no-confirm || return 1
}
function setup_arch_with_yay() {
local targets=("aur-any") packages
is_laptop && targets+=("aur-laptop")
while read -r package; do
for package in $(get_packages "${targets[@]}"); do
if pacman -Qs "^$package$" >/dev/null; then
if $UPGRADE_PACKAGES; then
echo "Package '$package' will be upgraded."
@ -107,18 +109,20 @@ function setup_arch_with_yay() {
echo "Package '$package' will be installed."
fi
# shellcheck disable=SC2086
yay -S "$package" $YAY_ARGS || return 1
done <<<"$(get_packages "${targets[@]}")"
sudo pamac build "$package" --no-confirm || return 1
done
}
function setup_arch() {
setup_arch_with_pamac || return 1
setup_arch_with_yay || return 2
configure_sddm || return 3
prepare_arch || return 1
setup_arch_with_pamac || return 2
setup_arch_with_yay || return 3
configure_sddm || return 4
}
echo "Setting up ${ID_LIKE^}-like OS."
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
echo "Setting up ${ID_LIKE^:?}-like OS."
if [[ "$ID_LIKE" == "arch" ]]; then
setup_arch