aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/install-with-disko23
1 files changed, 20 insertions, 3 deletions
diff --git a/scripts/install-with-disko b/scripts/install-with-disko
index a6210b9..5845c2d 100755
--- a/scripts/install-with-disko
+++ b/scripts/install-with-disko
@@ -1,17 +1,34 @@
#!/usr/bin/env nix-shell
#!nix-shell -i zsh --packages rsync zsh
+setopt ERR_EXIT NO_UNSET PIPE_FAIL
+
# load module to parse command line arguments
zmodload zsh/zutil
# parse any possible additional drive declarations
-zparseopts -D -E -A opts -- -skip-disko h
+zparseopts -D -E -A opts -- -skip-disko h x
-setopt ERR_EXIT NO_UNSET PIPE_FAIL
-DIR="${0:h}"
+# enable XTRACE shell option for full debugging output of scripts
+if (( ${+opts[-x]} )); then
+ set -x
+fi
+DIR="${0:h}"
TARGET_HOST="${1:-}"
+if [[ -z "${TARGET_HOST}" ]] || (( ${+opts[-h]} )); then
+ <<EOF >&2
+usage: ${0:t} [ --skip-disko ] [ -h ] [ -x ] host
+
+ --skip-disko skip running presumably already run disko step
+ -h this message
+ -x enable shell debug
+ host the host to install from our flake
+EOF
+ exit 1
+fi
+
if [[ "${USERNAME}" != "nixos" ]]; then
echo "ERROR! ${0:t} should be run as the nixos user from a NixOS installer." >&2
exit 1