25 lines
501 B
Bash
Executable File
25 lines
501 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"
|