From f298ad5f64bc1e495c73686a16e69ae91e23cf2f Mon Sep 17 00:00:00 2001 From: hayao Date: Sun, 9 May 2021 20:52:12 +0900 Subject: [PATCH] [update] : Supported pacman debug --- system/aur.sh | 22 +++++++++++++++------- system/pkgbuild.sh | 17 ++++++++++++----- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/system/aur.sh b/system/aur.sh index 3901e112..588a9d8f 100755 --- a/system/aur.sh +++ b/system/aur.sh @@ -10,6 +10,7 @@ set -e -u aur_username="aurbuild" pacman_debug=true +pacman_args=() trap 'exit 1' 1 2 3 15 @@ -72,18 +73,26 @@ pacman-key --populate # Un comment the mirror list. #sed -i "s/#Server/Server/g" "/etc/pacman.d/mirrorlist" +# Set pacman args +pacman_args=("--config" "/etc/alteriso-pacman.conf" "--noconfirm") +if [[ "${pacman_debug}" = true ]]; then + pacman_args+=("--debug") +fi + # Install yay if ! pacman -Qq yay 1> /dev/null 2>&1; then ( _oldpwd="$(pwd)" - pacman -Syy --noconfirm --config "/etc/alteriso-pacman.conf" - pacman --noconfirm -S --asdeps --needed go --config "/etc/alteriso-pacman.conf" + pacman -Syy "${pacman_args[@]}" + pacman -S --asdeps --needed "${pacman_args[@]}" go sudo -u "${aur_username}" git clone "https://aur.archlinux.org/yay.git" "/tmp/yay" cd "/tmp/yay" sudo -u "${aur_username}" makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm - pacman --noconfirm --config "/etc/alteriso-pacman.conf" -U $(sudo -u "${aur_username}" makepkg --packagelist) + for _pkg in $(sudo -u "${aur_username}" makepkg --packagelist); do + pacman "${pacman_args[@]}" -U "${_pkg}" + done cd .. - rm -rf "/tmp/yay" + remove "/tmp/yay" cd "${_oldpwd}" ) fi @@ -101,7 +110,6 @@ for _pkg in "${@}"; do yay -Sy \ --mflags "-AcC" \ --aur \ - --noconfirm \ --nocleanmenu \ --nodiffmenu \ --noeditmenu \ @@ -111,7 +119,7 @@ for _pkg in "${@}"; do --useask \ --color always \ --mflags "--skippgpcheck" \ - --config "/etc/alteriso-pacman.conf" \ + "${pacman_args[@]}" \ --cachedir "/var/cache/pacman/pkg/" \ "${_pkg}" @@ -121,7 +129,7 @@ for _pkg in "${@}"; do fi done -yay -Sccc --noconfirm --config "/etc/alteriso-pacman.conf" +yay -Sccc "${pacman_args[@]}" # remove user and file userdel "${aur_username}" diff --git a/system/pkgbuild.sh b/system/pkgbuild.sh index 676325f3..852534b5 100755 --- a/system/pkgbuild.sh +++ b/system/pkgbuild.sh @@ -10,6 +10,7 @@ set -e build_username="pkgbuild" pacman_debug=true +pacman_args=() _help() { echo "usage ${0} [option]" @@ -92,8 +93,14 @@ pacman-key --populate # Un comment the mirror list. #sed -i "s/#Server/Server/g" "/etc/pacman.d/mirrorlist" +# Set pacman args +pacman_args=("--config" "/etc/alteriso-pacman.conf" "--noconfirm") +if [[ "${pacman_debug}" = true ]]; then + pacman_args+=("--debug") +fi + # Update datebase -pacman -Syy --config "/etc/alteriso-pacman.conf" +pacman -Syy "${pacman_args[@]}" # Parse SRCINFO cd "${pkgbuild_dir}" @@ -106,23 +113,23 @@ if (( "${#pkgbuild_dirs[@]}" != 0 )); then if (( ${#depends[@]} + ${#makedepends[@]} != 0 )); then for _pkg in ${depends[@]} ${makedepends[@]}; do if pacman -Ssq "${_pkg}" | grep -x "${_pkg}" 1> /dev/null; then - pacman -S --config "/etc/alteriso-pacman.conf" --noconfirm --asdeps --needed "${_pkg}" + pacman -S --asdeps --needed "${pacman_args[@]}" "${_pkg}" fi done fi run_user makepkg -fACcs --noconfirm --skippgpcheck for pkg in $(run_user makepkg -f --packagelist); do - pacman --noconfirm --needed --config /etc/alteriso-pacman.conf -U "${pkg}" + pacman --needed "${pacman_args[@]}" -U "${pkg}" done cd - >/dev/null done fi if deletepkg=($(pacman -Qtdq)) && (( "${#deletepkg[@]}" != 0 )); then - pacman -Rsnc --noconfirm "${deletepkg[@]}" --config "/etc/alteriso-pacman.conf" + pacman -Rsnc "${deletepkg[@]}" "${pacman_args[@]}" fi -pacman -Sccc --noconfirm --config "/etc/alteriso-pacman.conf" +pacman -Sccc "${pacman_args[@]}" # remove user and file userdel "${build_username}" -- 2.11.0