]> code.delx.au - monosys/blobdiff - aur-install
split-mvimg
[monosys] / aur-install
index df5f604f7c0d0839591ee37efd33df694479afcf..6c5b5a2fd5cc65ce5ff72294aa25e751f922168c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -e
+set -eu
 
 PKGNAME="$1"
 if [ -z "$PKGNAME" ]; then
@@ -8,6 +8,12 @@ if [ -z "$PKGNAME" ]; then
     exit 1
 fi
 
+shift
+MAKEPKG_CMD=("$@")
+if [ ${#MAKEPKG_CMD[@]} -eq 0 ]; then
+    MAKEPKG_CMD=("makepkg" "-sri")
+fi
+
 function enter_directory {
     mkdir -p "$1"
     cd "$1"
@@ -27,7 +33,7 @@ function show_diff {
 }
 
 function ask_user_to_continue {
-    read -p "Ok? (y/n) " ok
+    read -r -p "Ok? (y/n) " ok
     if [ "$ok" != "y" ]; then
         return 1
     fi
@@ -35,10 +41,10 @@ function ask_user_to_continue {
 
 function build_and_install {
     git checkout .
-    makepkg -sri
+    "${MAKEPKG_CMD[@]}"
 }
 
-enter_directory "/var/abs/aur/${PKGNAME}"
+enter_directory "/var/abs/${PKGNAME}"
 fetch_latest_changes
 show_diff
 ask_user_to_continue