X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=build%2Fsuse-postun.sh;h=ac9f30c1eb836b38f2deee9eab3b428b0c8a2a4f;hb=dd0b91ac3a797c9ca3a1ed1dbbb56dae523b77da;hp=eb86d037a02d5db62b83da5d7f3406fa9ef09a9e;hpb=87a2010dd6dc319922325739995b4233518328db;p=fs%2Flustre-release.git diff --git a/build/suse-postun.sh b/build/suse-postun.sh index eb86d03..ac9f30c 100644 --- a/build/suse-postun.sh +++ b/build/suse-postun.sh @@ -9,7 +9,17 @@ else exit 0 fi -if [ "$(readlink /boot/$image)" = $image-%ver_str ]; then +case %ver_str in + (*xen*|*um*) + SHORTNM=%ver_str + SHORTNM=-${SHORTNM##*-} + ;; + (*) + unset SHORTNM + ;; +esac + +if [ "$(readlink /boot/$image$SHORTNM)" = $image-%ver_str ]; then # This may be the last kernel RPM on the system, or it may # be an update. In both of those cases the symlinks will # eventually be correct. Only if this kernel @@ -19,25 +29,49 @@ if [ "$(readlink /boot/$image)" = $image-%ver_str ]; then # manager will always have a kernel to boot in its default # configuration. shopt -s nullglob - for image in $(cd /boot ; ls -dt $image-*); do - initrd=initrd-${image#*-} - if [ -f /boot/$image -a -f /boot/$initrd ]; then - relink $image /boot/${image%%%%-*} - relink $initrd /boot/${initrd%%%%-*} + for img in $(cd /boot ; ls -dt $image-*$SHORTNM); do + initrd=initrd-${img#*-} + if [ -f /boot/$img -a -f /boot/$initrd ]; then + relink $img /boot/${img%%%%-*}$SHORTNM + relink $initrd /boot/${initrd%%%%-*}$SHORTNM + + # Notify the boot loader that a new kernel image is active. + if [ -x /sbin/new-kernel-pkg ]; then + /sbin/new-kernel-pkg $(/sbin/get_kernel_version /boot/$img) + fi break fi done shopt -u nullglob fi -# Created in the other kernel's %post -case "$(readlink /boot/$image.previous)" in -$image-%ver_str|$(readlink /boot/$image)) - rm -f /boot/$image.previous ;; +# remove the bootloader entry for the kernel being removed +if [ -x /usr/lib/bootloader/bootloader_entry ]; then + # handle 10.2 and SLES10 SP1 + /usr/lib/bootloader/bootloader_entry \ + remove \ + smp \ + %ver_str \ + vmlinuz-%ver_str \ + initrd-%ver_str +elif [ -x /sbin/update-bootloader ]; then + # handle 10.1 and SLES10 GA + /sbin/update-bootloader --image /boot/vmlinuz-%ver_str \ + --initrd /boot/initrd-%ver_str \ + --remove --force + /sbin/update-bootloader --refresh +fi + +# Check whether there is a .previous link to the image we're about +# to remove or to the image we point the new symlink to (so .previous +# would be identical to the current symlink) +case "$(readlink /boot/$image$SHORTNM.previous)" in +$image-%ver_str|$(readlink /boot/$image$SHORTNM)) + rm -f /boot/$image$SHORTNM.previous ;; esac -case "$(readlink /boot/initrd.previous)" in -initrd-%ver_str|$(readlink /boot/initrd)) - rm -f /boot/initrd.previous ;; +case "$(readlink /boot/initrd$SHORTNM.previous)" in +initrd-%ver_str|$(readlink /boot/initrd$SHORTNM)) + rm -f /boot/initrd$SHORTNM.previous ;; esac # created in %post rm -f /boot/initrd-%ver_str