Browse Source

updated function handling

Toastie 1 year ago
parent
commit
48fa74dd25
1 changed files with 8 additions and 9 deletions
  1. 8 9
      bootrap-bullseye.sh

+ 8 - 9
bootrap-bullseye.sh

@@ -32,15 +32,14 @@ netNTP=pool.ntp.org
 [ -f ./config.sh ] && source config.sh
 
 # Check if the function exists
-if declare -f "$1()" > /dev/null
-then
-  # call arguments verbatim
-  "$@()"
-else
-  # Show a helpful error
-  echo "Valid functions are: grmlnetwork, prepare, install, bootloader, postinstall" >&2
-  exit 1
-fi
+case $1 in
+  grmlnetwork) grmlnetwork() ;;
+  prepare)     prepare()     ;;
+  install)     install()     ;;
+  bootloader)  bootloader()  ;;
+  postinstall) postinstall() ;;
+  *) echo "Valid functions are: grmlnetwork, prepare, install, bootloader, postinstall" >&2  ;;
+esac
 
 
 prepare(){