OSDN Git Service

[update] : Supported --debug in aur.sh
authorhayao <shun819.mail@gmail.com>
Fri, 18 Dec 2020 08:48:24 +0000 (17:48 +0900)
committerhayao <shun819.mail@gmail.com>
Fri, 18 Dec 2020 08:48:24 +0000 (17:48 +0900)
system/aur.sh

index bb1def3..cdf9154 100755 (executable)
@@ -39,6 +39,35 @@ function user_check () {
     fi
 }
 
+_help() {
+    echo "usage ${0} [option] [packages]"
+    echo
+    echo "Run yay in airootfs" 
+    echo
+    echo " General options:"
+    echo "    -d                       Enable pacman debug"
+    echo "    -h                       This help message"
+}
+
+while getopts "dh" arg; do
+    case ${arg} in
+        d)
+            pacman_debug=true
+            ;;
+        h)
+            _help
+            exit 0
+            ;;
+        *)
+            _help
+            exit 1
+            ;;
+    esac
+done
+
+shift $((OPTIND - 1))
+
+
 # Creating a aur user.
 if [[ $(user_check ${aur_username}) = false ]]; then
     useradd -m -d "/aurbuild_temp" "${aur_username}"
@@ -67,10 +96,14 @@ yes | sudo -u aurbuild \
         --noupgrademenu \
         --noprovides \
         --removemake \
+        $( 
+            if [[ "${pacman_debug}" = true ]]; then
+                echo -n "--debug"
+            fi
+        ) \
         --config "/etc/alteriso-pacman.conf" \
         ${*}
 
-
 # remove user and file
 userdel aurbuild
 remove /aurbuild_temp