Commit b6c52245 authored by Natanael Copa's avatar Natanael Copa

main/mkinitfs: cleanup links and initramfs on uninstall

parent ce00a965
# Maintainer: Natanael Copa <ncopa@alpinelinux.org> # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mkinitfs pkgname=mkinitfs
pkgver=2.0_rc6 pkgver=2.0_rc6
pkgrel=1 pkgrel=2
pkgdesc="Tool to generate initramfs images for Alpine" pkgdesc="Tool to generate initramfs images for Alpine"
url=http://git.alpinelinux.org/cgit/mkinitfs url=http://git.alpinelinux.org/cgit/mkinitfs
depends="busybox apk-tools>=2.0_rc7" depends="busybox apk-tools>=2.0_rc7"
......
...@@ -3,16 +3,19 @@ ...@@ -3,16 +3,19 @@
for i in "$@"; do for i in "$@"; do
# get last element in path # get last element in path
flavor=${i##*/} 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) abi_release=$(cat "$i"/kernel.release)
initfs=initramfs-$abi_release initfs=initramfs-$abi_release
mkinitfs -o /boot/$initfs $abi_release mkinitfs -o /boot/$initfs $abi_release
ln -sf $initfs /boot/initramfs-$flavor ln -sf $initfs /boot/initramfs-$flavor
ln -sf vmlinuz-$abi_release /boot/vmlinuz-$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... #this is for compat. to be removed eventually...
ln -sf vmlinuz-$flavor /boot/$flavor ln -sf vmlinuz-$flavor /boot/$flavor
ln -sf initramfs-$flavor /boot/$flavor.gz ln -sf initramfs-$flavor /boot/$flavor.gz
...@@ -29,3 +32,9 @@ for i in "$@"; do ...@@ -29,3 +32,9 @@ for i in "$@"; do
fi fi
done 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment