OSDN Git Service

[update] : Supported pacman debug
authorhayao <hayao@fascode.net>
Sun, 9 May 2021 11:52:12 +0000 (20:52 +0900)
committerhayao <hayao@fascode.net>
Sun, 9 May 2021 11:52:12 +0000 (20:52 +0900)
system/aur.sh
system/pkgbuild.sh

index 3901e11..588a9d8 100755 (executable)
@@ -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}"
index 676325f..852534b 100755 (executable)
@@ -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}"