summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-04-07 22:18:11 +0200
committertv <tv@shackspace.de>2015-05-19 23:15:56 +0200
commit6e70d8fc47f0725a63dc92c1c43d2b1831c7c4ef (patch)
tree98207076bb84973f8fe9cfb83bdac81d08388e0e
parentd65277c9a3df97be8af39fb370e1c560e61011e1 (diff)
run -> {deploy,lib/prelude.sh}
-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
+ "$@"
+}