run -> {deploy,lib/prelude.sh}
This commit is contained in:
parent
d65277c9a3
commit
6e70d8fc47
15
deploy
Executable file
15
deploy
Executable 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
22
run → lib/prelude.sh
Executable file → Normal 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
|
||||
"$@"
|
||||
}
|
Loading…
Reference in New Issue
Block a user