kickstart/lib/kickstart-deploy
2014-03-19 18:23:28 -03:00

25 lines
491 B
Bash
Executable File

#!/bin/bash -e
[[ "$1" == "--sudo" ]] && prefix="sudo " && shift
[[ "$1" == "--password" ]] && shift && prefix="echo \"$1\" | sudo -S " && shift
target=$1
[ "$target" ] || echo "Please, provide an ssh target"
shift
[ "$DEBUG" ] && debug="-x"
remote_command=$(
cat <<CMD
target=\$(mktemp -d -t kickstart.XXXXX)
mkdir -p \$target
cd \$target
tar xz
$prefix bash $debug install.sh
rm -rf \$target
CMD
)
kickstart compile $@
tar chz -C compile . | ssh $target "$remote_command"