summaryrefslogtreecommitdiffstats
path: root/main/mkinitfs/mkinitfs.trigger
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-12-16 20:13:32 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-12-16 20:13:32 +0000
commitb6c5224513cf1eeabfbb30bafa4d098794b902fb (patch)
treee2f8c6cb51fc6b9fd5182b58c833f471818e684d /main/mkinitfs/mkinitfs.trigger
parentce00a965a02eab8138760f441295025f0174b381 (diff)
downloadaports-b6c5224513cf1eeabfbb30bafa4d098794b902fb.tar.bz2
aports-b6c5224513cf1eeabfbb30bafa4d098794b902fb.tar.xz
main/mkinitfs: cleanup links and initramfs on uninstall
Diffstat (limited to 'main/mkinitfs/mkinitfs.trigger')
-rw-r--r--main/mkinitfs/mkinitfs.trigger17
1 files changed, 13 insertions, 4 deletions
diff --git a/main/mkinitfs/mkinitfs.trigger b/main/mkinitfs/mkinitfs.trigger
index c181233e8..f21a157e5 100644
--- a/main/mkinitfs/mkinitfs.trigger
+++ b/main/mkinitfs/mkinitfs.trigger
@@ -3,16 +3,19 @@
for i in "$@"; do
# get last element in path
flavor=${i##*/}
+ if ! [ -f "$i"/kernel.release ]; then
+ # kernel was uninstalled
+ rm -f $( readlink -f /boot/initramfs-$flavor ) \
+ /boot/initramfs-$flavor /boot/vmlinuz-$flavor \
+ /boot/$flavor /boot/$flavor.gz /$flavor /$flavor.gz
+ continue
+ fi
abi_release=$(cat "$i"/kernel.release)
initfs=initramfs-$abi_release
mkinitfs -o /boot/$initfs $abi_release
ln -sf $initfs /boot/initramfs-$flavor
ln -sf vmlinuz-$abi_release /boot/vmlinuz-$flavor
- # extlinux will use path relative partition, so if /boot is on a
- # separate partition we want /boot/<kernel> resolve to /<kernel>
- [ -e /boot/boot ] || ln -sf / /boot/boot
-
#this is for compat. to be removed eventually...
ln -sf vmlinuz-$flavor /boot/$flavor
ln -sf initramfs-$flavor /boot/$flavor.gz
@@ -29,3 +32,9 @@ for i in "$@"; do
fi
done
+# extlinux will use path relative partition, so if /boot is on a
+# separate partition we want /boot/<kernel> resolve to /<kernel>
+if ! [ -e /boot/boot ]; then
+ ln -sf / /boot/boot
+fi
+