diff --git a/deploy b/deploy new file mode 100755 index 000000000..d435ec8b1 --- /dev/null +++ b/deploy @@ -0,0 +1,15 @@ +#! /bin/sh +# +# usage: ./deploy CONFIG [[USER@]HOST] +# +set -euf + +. ./lib/prelude.sh + +user=root +host=$1 + +config=./$host.nix +target=${2-$user@$host} + +verbose deploy "$config" "$target" diff --git a/run b/lib/prelude.sh old mode 100755 new mode 100644 similarity index 95% rename from run rename to lib/prelude.sh index 073111f1d..00fa92a4e --- a/run +++ b/lib/prelude.sh @@ -1,17 +1,3 @@ -#! /bin/sh -set -euf - -main() { - case "$1" in - (deploy) - "$@" - ;; - (*) - echo "$0: unknown command: $1" >&2 - exit 23 - esac -} - # deploy : nixos-config x [user@]hostname -> () deploy() {( main=$1 @@ -199,6 +185,8 @@ make_parent_dirs() { fi } -if [ "${noexec-}" != 1 ]; then - main "$@" -fi +# verbose COMMAND [ARGS...] +verbose() { + echo "$@" >&2 + "$@" +}