Whamcloud - gitweb
Remove trailing /lustre from lustre/ldlm/lustre pathnames.
[fs/lustre-release.git] / build / suse-postun.sh
1 if [ -L /boot/vmlinux ]; then
2     image=vmlinux
3 elif [ -L /boot/vmlinuz ]; then
4     image=vmlinuz
5 elif [ -L /boot/image ]; then
6     image=image
7 else
8     # nothing to do (UML kernels for example).
9     exit 0
10 fi
11
12 if [ "$(readlink /boot/$image)" = $image-%ver_str ]; then
13     # This may be the last kernel RPM on the system, or it may
14     # be an update. In both of those cases the symlinks will
15     # eventually be correct. Only if this kernel
16     # is removed and other kernel rpms remain installed,
17     # find the most recent of the remaining kernels, and make
18     # the symlinks point to it. This makes sure that the boot
19     # manager will always have a kernel to boot in its default
20     # configuration.
21     shopt -s nullglob
22     for image in $(cd /boot ; ls -dt $image-*); do
23         initrd=initrd-${image#*-}
24         if [ -f /boot/$image -a -f /boot/$initrd ]; then
25             relink $image /boot/${image%%%%-*}
26             relink $initrd /boot/${initrd%%%%-*}
27             break
28         fi
29     done
30     shopt -u nullglob
31 fi
32
33 # Created in the other kernel's %post
34 case "$(readlink /boot/$image.previous)" in
35 $image-%ver_str|$(readlink /boot/$image))
36     rm -f /boot/$image.previous ;;
37 esac
38 case "$(readlink /boot/initrd.previous)" in
39 initrd-%ver_str|$(readlink /boot/initrd))
40     rm -f /boot/initrd.previous ;;
41 esac
42 # created in %post
43 rm -f /boot/initrd-%ver_str