From 62b28f7d84c422ab2c16f9a24aa6189a7dd57ac0 Mon Sep 17 00:00:00 2001 From: Mark Nipper Date: Fri, 3 May 2024 00:28:33 -0700 Subject: Add help --- scripts/install-with-disko | 23 ++++++++++++++++++++--- 1 file 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 + <&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 -- cgit v1.2.3