10df7fe2b072b48d566689b7769bb94f272a9bab
chmalee
  Thu Mar 9 11:21:35 2023 -0800
restore the swapfile when upgrading gbibs from 14, refs #30708

diff --git src/browserbox/root/updateBrowser.sh src/browserbox/root/updateBrowser.sh
index 56fb724..0ee51be 100755
--- src/browserbox/root/updateBrowser.sh
+++ src/browserbox/root/updateBrowser.sh
@@ -132,30 +132,36 @@
     rm /swapfile
 
     # check for upgrades first
     apt-get install -y --only-upgrade apt
 
     # remove old packages and linux versions to make sure there is enough free space
     apt-get clean && sudo apt-get autoremove
     apt-get purge -y $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
 
     # add the below to /etc/apt/apt.conf so non-interactive update will work (https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1640274/comments/5):
     echo 'Dpkg::Options { "--force-confold"; }' >> /etc/apt/apt.conf
 
     # finally do the upgrade
     do-release-upgrade -f DistUpgradeViewNonInteractive
 
+    # restore the swapfile
+    dd if=/dev/zero of=/swapfile bs=1M count=1024
+    chmod 600 /swapfile
+    mkswap /swapfile
+    swapon /swapfile
+
     # turn off apparmor because it doesn't play nice with mysql
     systemctl stop apparmor.service
     update-rc.d -f apparmor remove
 
     # do a restart to force apparmor changes
     # need a flag to tell the OS to restart mysql after the changes
     touch /root/doRestartMysql
     shutdown -r now
 fi
 
 if [ -e /root/doRestartMysql ]; then
     service mysql restart
     rm -f /root/doRestartMysql
 fi