about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xhm/soispha/pkgs/scripts/apps/fupdate.sh50
1 files changed, 23 insertions, 27 deletions
diff --git a/hm/soispha/pkgs/scripts/apps/fupdate.sh b/hm/soispha/pkgs/scripts/apps/fupdate.sh
index c038fa69..afc3ab13 100755
--- a/hm/soispha/pkgs/scripts/apps/fupdate.sh
+++ b/hm/soispha/pkgs/scripts/apps/fupdate.sh
@@ -72,12 +72,16 @@ ask_to_allow_update_script() {
 update() {
     update_script="$1"
     flake_base_dir="$2"
+    shift 2;
 
-    [ "$update_script" = "" ] || "$update_script"
+    dbg "Provided following args to update script: '$*'"
     dbg "changed directory to: $flake_base_dir"
     cd "$flake_base_dir" || die "Provided dir \'$flake_base_dir\' can not be accessed"
 
     nix flake update
+
+    [ "$update_script" = "" ] || "$update_script" "$@"
+
     if grep '[^0-9]_[0-9]' flake.lock >/dev/null; then
         batgrep '[^0-9]_[0-9]' flake.lock
         die "Your flake.nix contains duplicate inputs!"
@@ -113,12 +117,12 @@ main() {
         dbg "flake_base_dir is: $flake_base_dir"
 
         if [ "$update_script" = "" ]; then
-            update "" "$flake_base_dir"
+            update "" "$flake_base_dir" "$@"
         elif check_for_allowed_update_script "$update_script" && ! [ "$update_script" = "" ]; then
-            update "$update_script" "$flake_base_dir"
+            update "$update_script" "$flake_base_dir" "$@"
         else
             ask_to_allow_update_script "$update_script"
-            main
+            main "$@"
         fi
     fi
 }
@@ -144,26 +148,18 @@ for input in "$@"; do
     [ "$end_of_cli_options" = "true" ] && break
 done
 
-while [ "$#" -ne 0 ]; do
-    case "$1" in
-    "flake")
-        main
-        shift 1
-        ;;
-    *)
-        command="$1"
-        shift 1
-        [ "$1" = "--" ] && shift 1
-        if which update-"$command" >/dev/null 2>&1; then
-            if [ "$end_of_cli_options" = "true" ]; then
-                update-"$command" "$@"
-            else
-                update-"$command"
-            fi
-        else
-            die "command \"update-$command\" is not executable, or does not exist"
-        fi
-        ;;
-    esac
-    [ "$end_of_cli_options" = "true" ] && break
-done
+case "$1" in
+"flake")
+    shift 1
+    main "$@"
+    ;;
+*)
+    command="$1"
+    shift 1
+    if which update-"$command" >/dev/null 2>&1; then
+            update-"$command" "$@"
+    else
+        die "command \"update-$command\" is not executable, or does not exist"
+    fi
+    ;;
+esac