kickstart/lib/kickstart-deploy
2014-02-21 21:27:32 -03:00

24 lines
477 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
[ -d ~/kickstart ] && rm -rf ~/kickstart
mkdir ~/kickstart
cd ~/kickstart
tar xz
$prefix bash $debug install.sh
CMD
)
kickstart compile $@
tar chz -C compile . | ssh $target "$remote_command"