bug4811: in imageupgrade.sh script clean /tmp/image-upgrade-finished upon shutdown to have it gone when re-booting an image created this way

This commit is contained in:
Axel Uhl
2021-02-10 09:04:13 +01:00
parent 089c40b834
commit 95c18d10e6
+4 -3
View File
@@ -50,9 +50,10 @@ update_root_crontab() {
crontab crontab
}
clean_root_ssh_dir() {
clean_root_ssh_dir_and_tmp() {
echo "Cleaning up /root/.ssh" >>/var/log/sailing.err
rm -rf /root/.ssh/*
rm -rf /tmp/image-upgrade-finished
}
run_yum_update
@@ -69,7 +70,7 @@ if /opt/aws/bin/ec2-metadata -d | grep "^no-shutdown$"; then
echo "Shutdown disabled by no-shutdown option in user data. Remember to clean /root/.ssh when done."
touch /tmp/image-upgrade-finished
else
# Only clean root's .ssh directory if the next step is shutdown / image creation
clean_root_ssh_dir
# Only clean root's .ssh directory and /tmp/image-upgrade-finished if the next step is shutdown / image creation
clean_root_ssh_dir_and_tmp
shutdown -h now &
fi