kickstart/lib/kickstart-deploy

25 lines
491 B
Plaintext
Raw Normal View History

2014-02-20 16:19:43 +00:00
#!/bin/bash -e
2014-02-21 18:59:46 +00:00
[[ "$1" == "--sudo" ]] && prefix="sudo " && shift
2014-02-22 00:27:32 +00:00
[[ "$1" == "--password" ]] && shift && prefix="echo \"$1\" | sudo -S " && shift
2014-02-21 18:59:46 +00:00
2014-02-20 16:19:43 +00:00
target=$1
[ "$target" ] || echo "Please, provide an ssh target"
shift
2014-02-22 00:14:39 +00:00
[ "$DEBUG" ] && debug="-x"
2014-02-21 18:59:46 +00:00
2014-02-20 16:19:43 +00:00
remote_command=$(
cat <<CMD
2014-03-19 21:23:28 +00:00
target=\$(mktemp -d -t kickstart.XXXXX)
mkdir -p \$target
cd \$target
2014-02-20 16:19:43 +00:00
tar xz
2014-02-22 00:14:39 +00:00
$prefix bash $debug install.sh
2014-03-19 21:23:28 +00:00
rm -rf \$target
2014-02-20 16:19:43 +00:00
CMD
)
kickstart compile $@
tar chz -C compile . | ssh $target "$remote_command"