Whamcloud - gitweb
add support for sles 8:
[fs/lustre-release.git] / build / sles8-postun.sh
diff --git a/build/sles8-postun.sh b/build/sles8-postun.sh
new file mode 100644 (file)
index 0000000..fe1ded5
--- /dev/null
@@ -0,0 +1,22 @@
+rm -f /boot/initrd-%ver_str  # created in %post -- clean up.
+
+if [ "$(readlink /boot/vmlinuz)" = "vmlinuz-%ver_str" -o \
+     "$(readlink /boot/initrd)"  = "initrd-%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. On the other hand, if this kernel
+    # is removed and other kernel rpms remain installed,
+    # find the most recent of the remaining kernels, and make
+    # the symlinks point to it. This makes sure that the boot
+    # manager will always have a kernel to boot in its default
+    # configuration.
+    for vmlinuz in $(cd /boot ; ls -dt vmlinuz-*); do
+       version="${vmlinuz#vmlinuz-}"
+       initrd="initrd-$version"
+       if [ -f "/boot/$vmlinuz" -a -f "/boot/$initrd" ]; then
+           relink "$vmlinuz" /boot/vmlinuz
+           relink "$initrd" /boot/initrd
+           break
+       fi
+    done
+fi