--- wrapupgradepkg.bof 2021-02-09 17:54:05.676047288 +0100 +++ wrapupgradepkg 2021-03-17 10:44:04.418806000 +0100 @@ -2,7 +2,7 @@ # Written by Didier Spaier this script is dedicated to the public domain. # # This script is called by slapt-get --upgrade like this: -# +# # Its main purpose is to perform specific actions when upgrading kernels # Rationale: we want to make sure that a working kernel be always installed, but # we don't want to keep more kernels than necessary, to save space on disk and @@ -21,7 +21,7 @@ # generic one will be running we will remove the one initially installed upon # next upgrade of a generic kernel. LOG=/tmp/wrapupgradepkglog -rm -f $LOG +date >>$LOG FSTYPE=$(findmnt -no fstype /) RUNNINGVERSION=$(uname -r) # We are called with the patch to the new package as $2 @@ -42,9 +42,9 @@ # "stat -c %Y $i" that you could insert below, probably an overkill. usepkgtools() { # This function is only called to upgrade kernel-generic or kernel-headers - if [ "$NEWSHORTNAME" = "kernel-generic" ]; then + if [ "$NEWSHORTNAME" = "kernel-generic" ]; then INSTALLED=$(ls -1 /var/log/packages|grep -e "kernel-generic" -e "kernel-huge") - else + else INSTALLED=$(ls -1 /var/log/packages|grep -e "$NEWSHORTNAME") fi installpkg $NEWKERNELPATH @@ -74,8 +74,8 @@ echo "not removing $i" >>$LOG continue fi - echo "spkg -d $i" >>$LOG - spkg -d $i + echo "spkg -d /var/log/packages/$i" + spkg -d /var/log/packages/$i [ "$NEWSHORTNAME" = "kernel-modules" ] && \ [ -f /boot/initrd-generic-$iVERSION ] && \ rm /boot/initrd-generic-$iVERSION @@ -87,15 +87,15 @@ MODULESINSTALLED=$(ls -1 /var/log/packages/|grep ^kernel-modules-$NEWVERSION) KERNELINSTALLED=$(ls -1 /var/log/packages/|grep ^kernel-generic-$NEWVERSION) # Remove the huge kernel and the symlinks we won't use, just in case a user - # upgraded from an previous version or migrated from Slackware + # upgraded from an previous version or migrated from Slackware if ls -1 /boot|grep -q vmlinuz-huge; then - removepkg kernel-huge + removepkg kernel-huge fi ( cd /boot rm -f System.map config config-generic vmlinuz{,-generic,-huge} ) if [ "$MODULESINSTALLED" ] && [ "$KERNELINSTALLED" ]; then - /usr/sbin/geninitrd >>$LOG + /usr/sbin/geninitrd # change the way to know that the system should be portable as in # this case we do not write a custom grub.cfg any more if [ ! -f /boot/grub/grub.cfg ] && grep -q "# This grub.cfg is part of a portable Slint." /boot/grub/grub.cfg; then @@ -160,7 +160,7 @@ mkinitrd \ -k $KERNELVERSION \ -w $rootdelay \ - -r UUID=$ROOT_UUID \ + -r UUID=$ROOTUUID \ -m $MODULES \ -o /boot/initrd-generic-$KERNELVERSION >>$LOG fi @@ -179,14 +179,14 @@ gettext "Updating GRUB..." echo update-grub - echo "update-grub" >>$LOG + echo "update-grub" >>$LOG echo fi } case $NEWSHORTNAME in - kernel-generic) usepkgtools;initrdandgrub;; - kernel-modules) usespkg;initrdandgrub;; - kernel-headers) usepkgtools;; - kernel-source|libreoffice|mozilla-firefox|mozilla-thunderbird) usespkg;; - *) upgradepkg --reinstall $NEWKERNELPATH;; + kernel-generic) usepkgtools;initrdandgrub; echo "usespktools and initrdandgrub ran." >>$LOG;; + kernel-modules) usespkg;initrdandgrub; echo "usepkg and initrdandgrub ran." >>$LOG;; + kernel-headers) usepkgtools; echo "usespkgtools ran." >>$LOG;; + kernel-source|libreoffice|mozilla-firefox|mozilla-thunderbird) usespkg; echo "usespkg ran." >>$LOG;; + *) upgradepkg --reinstall $NEWKERNELPATH; echo "upgradepkg --reinstall ran." >>$LOG;; esac