Commit 03b3c418 authored by Natanael Copa's avatar Natanael Copa

main/mkinitfs: delay umount of apkovl media so apk cache is available

When installing the apks we might need the apk cache so we need wait
with unmounting the apkovl media

ref #736
parent 89a33f1e
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mkinitfs
pkgver=2.3.4
pkgrel=3
pkgrel=4
pkgdesc="Tool to generate initramfs images for Alpine"
url=http://git.alpinelinux.org/cgit/mkinitfs
depends="busybox apk-tools>=2.0"
......@@ -9,6 +9,7 @@ triggers="$pkgname.trigger=/usr/share/kernel/*"
source="http://git.alpinelinux.org/cgit/$pkgname.git/snapshot/$pkgname-$pkgver.tar.bz2
0001-init-fix-progressbar-when-not-quiet.patch
mount-move.patch
delay-umount-apkovl.patch
eglibc.patch
"
arch="noarch"
......@@ -47,4 +48,5 @@ package() {
md5sums="abec6dced89e137dc60542c1e5f938ac mkinitfs-2.3.4.tar.bz2
4ea4389d5dff0a69d6792420574d2f1f 0001-init-fix-progressbar-when-not-quiet.patch
049392dd315240d2c7d892ef67072e03 mount-move.patch
6d8b0a6f3b7a90152d84eda373743d84 delay-umount-apkovl.patch
e59c2f7de496fe430b07e32fd812ebe0 eglibc.patch"
diff --git a/initramfs-init.in b/initramfs-init.in
index f64ef26..8f01c8f 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -244,8 +244,8 @@ resolve_dev() {
esac
}
-# remount ALPINE_MNT according given fstab
-remount_alpine_mnt() {
+# relocate ALPINE_MNT according given fstab
+relocate_alpine_mnt() {
local fstab="$1"
local mnt=$(find_mnt $ALPINE_DEV $fstab)
if [ "$ALPINE_MNT" != "$mnt" ]; then
@@ -253,10 +253,6 @@ remount_alpine_mnt() {
mount -o move $ALPINE_MNT $mnt
ALPINE_MNT=$mnt
fi
- # respect users mount options in fstab
- if [ -n "$MNTOPTS" ]; then
- mount -o remount,$MNTOPTS "$ALPINE_MNT"
- fi
}
# gotta start from somewhere :)
@@ -458,7 +454,6 @@ if [ -f "$ovl" ]; then
eend $? $errstr || ovlfiles=
# hack, incase /root/.ssh was included in apkovl
[ -d "$sysroot/root" ] && chmod 700 "$sysroot/root"
- umount $ovl_unmount 2>/dev/null &
pkgs="$pkgs $(sed 's/\#.*//' $sysroot/etc/lbu/packages.list 2>/dev/null)"
rm -f "$sysroot"/etc/lbu/packages.list
pkgs="$pkgs $(cat $sysroot/var/lib/apk/world $sysroot/etc/apk/world 2>/dev/null)"
@@ -480,12 +475,19 @@ else
rc_add savecache shutdown
fi
-# let user override tmpfs size in fstab in apkovl
if [ -f $sysroot/etc/fstab ]; then
+ has_fstab=1
+
+ # let user override tmpfs size in fstab in apkovl
mountopts=$(awk '$2 == "/" && $3 == "tmpfs" { print $4 }' $sysroot/etc/fstab)
if [ -n "$mountopts" ]; then
mount -o remount,$mountopts $sysroot
fi
+
+ # move the ALPINE_MNT if ALPINE_DEV is specified in users fstab
+ # this is so a generated /etc/apk/repositories will use correct
+ # mount dir
+ relocate_alpine_mnt "$sysroot"/etc/fstab
fi
# in case we upgrade we might need those:
@@ -496,13 +498,6 @@ rc_add modloop sysinit
# hack so we get openrc
pkgs="$pkgs alpine-base"
-# move the ALPINE_MNT if ALPINE_DEV is specified in users fstab
-# this is so a generated /etc/apk/repositories will use correct mount dir
-if [ -f "$sysroot"/etc/fstab ]; then
- has_fstab=1
- remount_alpine_mnt "$sysroot"/etc/fstab
-fi
-
# copy keys so apk finds them. apk looks for stuff relative --root
mkdir -p $sysroot/etc/apk/keys/
cp -a /etc/apk/keys $sysroot/etc/apk
@@ -537,11 +532,23 @@ else
fi
eend $?
+# unmount ovl mount if needed
+if [ -n "$ovl_unmount" ]; then
+ umount $ovl_unmount 2>/dev/null
+fi
+
# remount ALPINE_MNT according default fstab from package
if [ -z "$has_fstab" ] && [ -f "$sysroot"/etc/fstab ]; then
- remount_alpine_mnt "$sysroot"/etc/fstab
+ relocate_alpine_mnt "$sysroot"/etc/fstab
fi
+# respect mount options in fstab for ALPINE_MNT (e.g if user wants rw)
+opts=$(awk "\$2 == \"$ALPINE_MNT\" {print \$4}" $sysroot/etc/fstab)
+if [ -n "$opts" ]; then
+ mount -o remount,$opts "$ALPINE_MNT"
+fi
+
+
# fix inittab if alternative console
setup_inittab_console $CONSOLE
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