bugfix calling as nonroot user
[automated-distro-installer] / myfai-chboot-local
index 5140f68bb73f349bdf741974b1fbef7e7ba076c5..d8d484658bc1d8895319f32de764a84a5927bec2 100755 (executable)
@@ -1,5 +1,8 @@
 #!/bin/bash
 # note, this script gets piped to bash, so cant cd to current dir
+
+[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@"
+
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
@@ -29,8 +32,6 @@ while [[ $1 == -* ]]; do
   esac
 done
 
-[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@"
-
 e() {
   echo "$*"
   if ! "$@"; then