diff options
Diffstat (limited to 'main/mkinitfs/mount-move.patch')
-rw-r--r-- | main/mkinitfs/mount-move.patch | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/main/mkinitfs/mount-move.patch b/main/mkinitfs/mount-move.patch deleted file mode 100644 index 4931663246..0000000000 --- a/main/mkinitfs/mount-move.patch +++ /dev/null @@ -1,115 +0,0 @@ -diff --git a/initramfs-init.in b/initramfs-init.in -index 2ff2585..f64ef26 100755 ---- a/initramfs-init.in -+++ b/initramfs-init.in -@@ -104,10 +104,32 @@ unpack_apkovl() { - } - - # find mount dir for given device in an fstab -+# returns global MNTOPTS - find_mnt() { -- local dev="$1" -- local fsfile="$2" -- awk "\$1 == \"$dev\" {print \$2}\"" "$fsfile" 2>/dev/null -+ local search_dev="$1" fstab="$2" -+ MNTOPTS= -+ [ -r "$fstab" ] || return 1 -+ local dev mnt fs chk -+ case "$search_dev" in -+ UUID=*|LABEL=*|/dev/*);; -+ *) search_dev=/dev/$search_dev;; -+ esac -+ local search_real_dev=$(resolve_dev $search_dev) -+ while read dev mnt fs MNTOPTS chk; do -+ local real_dev=$(resolve_dev $dev) -+ local i j -+ for i in "$search_dev" "$search_real_dev"; do -+ [ -z "$i" ] && continue -+ for j in "$dev" "$real_dev"; do -+ [ -z "$j" ] && continue -+ if [ "$i" = "$j" ]; then -+ echo "$mnt" -+ return -+ fi -+ done -+ done -+ done < $fstab -+ MNTOPTS= - } - - # Wait for usb to settle -@@ -214,6 +236,29 @@ start_lvm() { - lvm vgchange --ignorelockingfailure -a y >/dev/null 2>&1 - } - -+# resolve an uuid or symlink to the real device -+resolve_dev() { -+ case "$1" in -+ UUID=*|LABEL=*) findfs "$1";; -+ *) readlink -f "$1";; -+ esac -+} -+ -+# remount ALPINE_MNT according given fstab -+remount_alpine_mnt() { -+ local fstab="$1" -+ local mnt=$(find_mnt $ALPINE_DEV $fstab) -+ if [ "$ALPINE_MNT" != "$mnt" ]; then -+ mkdir -p "$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 :) - echo "Alpine Init $VERSION" - -@@ -270,7 +315,7 @@ if [ -n "$KOPT_ovl_dev" ] ; then - fi - - case "$ALPINE_DEV" in -- UUID=*) ;; -+ UUID=*|LABEL=*) ;; - *) ALPINE_DEV=/dev/$ALPINE_DEV ;; - esac - -@@ -453,20 +498,9 @@ 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 --new_mnt=$(find_mnt $ALPINE_DEV $sysroot/etc/fstab) --if [ -n "$new_mnt" ] && [ "$new_mnt" != "$ALPINE_MNT" ]; then -- mkdir -p $new_mnt -- mount -o move $ALPINE_MNT $new_mnt -- ALPINE_MNT="$new_mnt" --fi -- --# let user set ALPINE_MNT as readonly in fstab --if [ -f $sysroot/etc/fstab ]; then -- mountopts=$(awk "\$2 == \"$ALPINE_MNT\" { print \$4 }" \ -- $sysroot/etc/fstab) -- if [ -n "$mountopts" ]; then -- mount -o remount,$mountopts $ALPINE_MNT -- fi -+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 -@@ -503,6 +537,11 @@ else - fi - eend $? - -+# remount ALPINE_MNT according default fstab from package -+if [ -z "$has_fstab" ] && [ -f "$sysroot"/etc/fstab ]; then -+ remount_alpine_mnt "$sysroot"/etc/fstab -+fi -+ - # fix inittab if alternative console - setup_inittab_console $CONSOLE - |