summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdeploy15
-rw-r--r--[-rwxr-xr-x]lib/prelude.sh (renamed from run)22
2 files changed, 20 insertions, 17 deletions
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
index 073111f1d..00fa92a4e 100755..100644
--- 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
+ "$@"
+}