run -> {deploy,lib/prelude.sh}

This commit is contained in:
tv 2015-04-07 22:18:11 +02:00
parent d65277c9a3
commit 6e70d8fc47
2 changed files with 20 additions and 17 deletions

15
deploy Executable file
View File

@ -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"

22
run → lib/prelude.sh Executable file → Normal file
View File

@ -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
"$@"
}