allow for provisioning opnly one host

This commit is contained in:
Donald Burr 2015-02-19 10:30:00 -08:00
parent 627ce44fa0
commit 0dab8e618e

View file

@ -4,10 +4,20 @@ if [ ! -f "$1" ]; then
exit 1
fi
./mkhosts.sh "$1"
./mkacatcher_cpp.sh "$1"
if [ -z "$2" ]; then
./mkhosts.sh "$1"
./mkacatcher_cpp.sh "$1"
fi
for HOST in `cat "$1"`; do
if [ ! -z "$2" ]; then
if grep -q "$2" "$1" ]; then
HOSTS="$2"
fi
else
HOSTS="`cat $1`"
fi
echo $HOSTS
for HOST in $HOSTS; do
>&2 echo "provisioning host $HOST"
ssh pi@$HOST "if [ ! -d \$HOME/.ssh ]; then mkdir \$HOME/.ssh; fi; echo `cat $HOME/.ssh/id_rsa.pub` >> \$HOME/.ssh/authorized_keys; chmod 700 \$HOME/.ssh; chmod 644 \$HOME/.ssh/authorized_keys"
for FILE in HOSTS SERVERIP stream.sh set_hostname.sh v4lcap.c; do scp $FILE pi@$HOST:$FILE; done