kickstart/lib/kickstart-bootstrap
2015-05-20 17:16:16 -03:00

19 lines
368 B
Bash
Executable File

#!/bin/bash -e
target=$1
[ "$target" ] || echo "Please, provide an ssh target"
shift
remote_command=$(
cat <<CMD
target=\$(mktemp -d -t kickstart.XXXXX)
mkdir -p \$target
cd \$target
tar xz
rm -rf /usr/local/bin/kickstart
ln -s \$target/bin/kickstart /usr/local/bin/kickstart
CMD
)
tar chz -C "$(kickstart root-dir)" . | ssh "$target" "$remote_command"