TT#24008 Add reboot support while creating ami images

Here we add @reboot crontab before reboot and then remove it after
installation finished after reboot

Change-Id: I76c0111cc2f0b76f6f8ff905b69816138ce14281
changes/59/16559/1
Sergii Kipot 8 years ago
parent 2f0b311563
commit 2ccb175f1c

@ -327,6 +327,9 @@ if [ -d /run/systemd/system ] ; then
apt update
apt install --yes sysvinit-core
echo "Rebooting now to switch from systemd to sysvinit"
#Temporary crontab to restart installer after reboot
(crontab -l ; echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") | crontab -
(crontab -l ; echo "@reboot FORCE=yes /usr/sbin/ngcp-installer 2>&1 | tee -a /var/log/ngcp-installer-debug.log") | crontab -
reboot
fi
@ -408,6 +411,9 @@ else
bailout 1
fi
#Remove temporary crontab
ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -i "${KEY_FILE}" "admin@$HOSTNAME" "sudo crontab -l || sudo crontab -r"
# reboot CE system
if $_opt_skip_reboot ; then
echo "*** Skipping system reboot of instance ID ${INSTANCE_ID} as requested via --skip-reboot ***"

Loading…
Cancel
Save