do not reobot machines
This commit is contained in:
parent
f24ce99391
commit
6ede4e0f23
2 changed files with 9 additions and 3 deletions
|
@ -24,7 +24,8 @@ for HOST in $HOSTS; do
|
||||||
ssh pi@$HOST "if ! dpkg -s screen >/dev/null 2>&1 ; then sudo apt-get -y install screen; fi"
|
ssh pi@$HOST "if ! dpkg -s screen >/dev/null 2>&1 ; then sudo apt-get -y install screen; fi"
|
||||||
ssh pi@$HOST "make v4lcap"
|
ssh pi@$HOST "make v4lcap"
|
||||||
ssh pi@$HOST "cd \$HOME && bash set_hostname.sh"
|
ssh pi@$HOST "cd \$HOME && bash set_hostname.sh"
|
||||||
ssh pi@$HOST "sudo reboot"
|
#ssh pi@$HOST "sudo reboot"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "all machines will require a few minutes to reboot, be patient grasshopper"
|
echo "all machines provisioned."
|
||||||
|
#echo "all machines will require a few minutes to reboot, be patient grasshopper"
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
MAC=`/sbin/ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | tr '[A-Z]' '[a-z]'`
|
MAC=`/sbin/ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | tr '[A-Z]' '[a-z]'`
|
||||||
if grep -q $MAC HOSTS; then
|
if grep -q $MAC HOSTS; then
|
||||||
HOSTNAME=`grep $MAC HOSTS | cut -d\| -f1`
|
HOSTNAME=`grep $MAC HOSTS | cut -d\| -f1`
|
||||||
|
if [ "$HOSTNAME" = "`hostname`" ]; then
|
||||||
|
echo 'hostname is already correct'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "setting hostname to $HOSTNAME"
|
echo "setting hostname to $HOSTNAME"
|
||||||
echo "$HOSTNAME" > /tmp/HOSTNAME.$$
|
echo "$HOSTNAME" > /tmp/HOSTNAME.$$
|
||||||
sudo rm -f /etc/hostname
|
sudo rm -f /etc/hostname
|
||||||
|
@ -10,7 +14,8 @@ if grep -q $MAC HOSTS; then
|
||||||
sudo chown root:root /etc/hostname
|
sudo chown root:root /etc/hostname
|
||||||
sudo chmod 644 /etc/hostname
|
sudo chmod 644 /etc/hostname
|
||||||
sudo /etc/init.d/hostname.sh
|
sudo /etc/init.d/hostname.sh
|
||||||
|
exit 0
|
||||||
else
|
else
|
||||||
echo "cannot determine hostname"
|
echo "cannot determine hostname"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit 1
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue