summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaudenz Steinlin <gaudenz@debian.org>2013-02-12 08:14:17 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 13:54:15 +0200
commit9555545410914f4f6cf1b1c00bb4a5b5dfe2b5cc (patch)
treef9ea7e63a07a61235bcb9d0575292baee88d651d
parentcc092da4c7a07d9370c5d0c7129fb02aa910b736 (diff)
downloadlive-boot-9555545410914f4f6cf1b1c00bb4a5b5dfe2b5cc.tar.gz
live-boot-9555545410914f4f6cf1b1c00bb4a5b5dfe2b5cc.zip
Fixing mounting of rootfs, cow and medium filesystems (Closes: #696495).
-rwxr-xr-xscripts/boot/9990-main.sh23
-rwxr-xr-xscripts/boot/9990-misc-helpers.sh14
-rwxr-xr-xscripts/boot/9990-overlay.sh23
3 files changed, 20 insertions, 40 deletions
diff --git a/scripts/boot/9990-main.sh b/scripts/boot/9990-main.sh
index c696781..fd10e5d 100755
--- a/scripts/boot/9990-main.sh
+++ b/scripts/boot/9990-main.sh
@@ -135,6 +135,19 @@ Main ()
mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
fi
+ # At this point /root should contain the final root filesystem.
+ # Move all mountpoints below /live into /root/lib/live/mount.
+ # This has to be done after mounting the root filesystem to /
+ # otherwise these mount points won't be accessible from the running system.
+ for _MOUNT in $(cat /proc/mounts | cut -f 2 -d " " | grep -e "^/live/")
+ do
+ local newmount
+ newmount="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
+ mkdir -p "${newmount}"
+ mount -o move "${_MOUNT}" "${newmount}" > /dev/null 2>&1 || \
+ mount -o bind "${_MOUNT}" "${newmount}" > /dev/null || \
+ log_warning_msg "W: failed to move or bindmount ${_MOUNT} to ${newmount}"
+ done
if [ -n "${ROOT_PID}" ]
then
@@ -151,9 +164,6 @@ Main ()
;;
esac
- # Move to the new root filesystem so that programs there can get at it.
- mkdir -p /root/lib/live/mount/medium
- mount --move /live/medium /root/lib/live/mount/medium
# aufs2 in kernel versions around 2.6.33 has a regression:
# directories can't be accessed when read for the first the time,
@@ -161,13 +171,6 @@ Main ()
# when booting FAI, this simple workaround solves it
ls /root/* >/dev/null 2>&1
- # Move findiso directory to the new root filesystem so that programs there can get at it.
- if [ -d /live/findiso ]
- then
- mkdir -p /root/lib/live/mount/findiso
- mount -n --move /live/findiso /root/lib/live/mount/findiso
- fi
-
# if we do not unmount the ISO we can't run "fsck /dev/ice" later on
# because the mountpoint is left behind in /proc/mounts, so let's get
# rid of it when running from RAM
diff --git a/scripts/boot/9990-misc-helpers.sh b/scripts/boot/9990-misc-helpers.sh
index a6ed2d0..18befee 100755
--- a/scripts/boot/9990-misc-helpers.sh
+++ b/scripts/boot/9990-misc-helpers.sh
@@ -733,7 +733,7 @@ mount_persistence_media ()
device=${1}
probe=${2}
- backing="${rootmnt}/lib/live/mount/persistence/$(basename ${device})"
+ backing="/live/persistence/$(basename ${device})"
mkdir -p "${backing}"
old_backing="$(where_is_mounted ${device})"
@@ -957,7 +957,7 @@ find_persistence_media ()
white_listed_devices="${2}"
ret=""
- black_listed_devices="$(what_is_mounted_on ${rootmnt}/lib/live/medium)"
+ black_listed_devices="$(what_is_mounted_on /live/medium)"
for dev in $(storage_devices "${black_listed_devices}" "${white_listed_devices}")
do
@@ -1260,7 +1260,7 @@ do_union ()
get_custom_mounts ()
{
- # Side-effect: leaves $devices with persistence.conf mounted in ${rootmnt}/lib/live/mount/persistence
+ # Side-effect: leaves $devices with persistence.conf mounted in /live/persistence
# Side-effect: prints info to file $custom_mounts
local custom_mounts devices bindings links
@@ -1299,7 +1299,7 @@ get_custom_mounts ()
if [ -n "${DEBUG}" ] && [ -e "${include_list}" ]
then
- cp ${include_list} ${rootmnt}/lib/live/mount/persistence/${persistence_list}.${device_name}
+ cp ${include_list} /live/persistence/${persistence_list}.${device_name}
fi
while read dir options # < ${include_list}
@@ -1484,7 +1484,7 @@ activate_custom_mounts ()
rootfs_dest_backing=""
if [ -n "${opt_link}"]
then
- for d in ${rootmnt}/lib/live/mount/rootfs/*
+ for d in /live/rootfs/*
do
if [ -n "${rootmnt}" ]
then
@@ -1514,7 +1514,7 @@ activate_custom_mounts ()
# has its own directory and isn't nested with some
# other custom mount (if so that mount's files would
# be linked, causing breakage.
- cow_dir="${rootmnt}/lib/live/mount/overlay/lib/live/mount/persistence/$(basename ${links_source})"
+ cow_dir="/live/overlay/lib/live/mount/persistence/$(basename ${links_source})"
mkdir -p ${cow_dir}
chown_ref "${source}" "${cow_dir}"
chmod_ref "${source}" "${cow_dir}"
@@ -1531,7 +1531,7 @@ activate_custom_mounts ()
# bind-mount and union mount are handled the same
# in read-only mode, but note that rootfs_dest_backing
# is non-empty (and necessary) only for unions
- cow_dir="${rootmnt}/lib/live/mount/overlay/${dest}"
+ cow_dir="/live/overlay/${dest}"
if [ -e "${cow_dir}" ] && [ -z "${opt_link}" ]
then
# If an earlier custom mount has files here
diff --git a/scripts/boot/9990-overlay.sh b/scripts/boot/9990-overlay.sh
index b4f5082..71e9a74 100755
--- a/scripts/boot/9990-overlay.sh
+++ b/scripts/boot/9990-overlay.sh
@@ -371,29 +371,6 @@ setup_unionfs ()
esac
done
- # move all /live mountpoints that the custom persistence
- # system depends on into /lib/live on the root filesystem
- for _DIRECTORY in rootfs
- do
- if [ -d "/live/${_DIRECTORY}" ]
- then
- mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}"
-
- for _MOUNT in $(ls /live/${_DIRECTORY})
- do
- mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
- mount -o move "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" > /dev/null 2>&1 || \
- mount -o bind "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" || \
- log_warning_msg "W: failed to mount /live/${_DIRECTORY}/${_MOUNT} to ${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
- done
- fi
- done
-
- mkdir -p "${rootmnt}/lib/live/mount/overlay"
- mount -o move /live/overlay "${rootmnt}/lib/live/mount/overlay" > /dev/null 2>&1 || \
- mount -o bind /live/overlay "${rootmnt}/lib/live/mount/overlay" || \
- log_warning_msg "W: failed to mount /live/overlay to ${rootmnt}/lib/live/mount/overlay"
-
# Adding custom persistence
if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
then