diff options
Diffstat (limited to 'defaults/initrd.scripts')
-rwxr-xr-x | defaults/initrd.scripts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 447d6323..7d2781ac 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -215,6 +215,13 @@ mount_sysfs() { [ "$ret" -eq '0' ] || bad_msg "Failed to mount /sys!" } +aufs_setup_dir() { + mount -t aufs -o "br:$OVERLAY=rw:$2=ro" -- aufs $1 + if [ "$?" -eq '0' ]; then + good_msg "Addition of $2 to $OVERLAY merged into $1" + fi +} + findnfsmount() { if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q then @@ -1048,6 +1055,34 @@ getdvhoff() { echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512)) } +setup_aufs() { + + # Directory used for rw changes in union mount filesystem + UNION=/aufs + OVERLAY=/overlay + + mkdir -p "${UNION}" + mkdir -p "${OVERLAY}" + mount -t tmpfs none "${OVERLAY}" + good_msg "Loading aufs module (if module)" + modprobe aufs > /dev/null 2>&1 + + aufs_setup_dir "${UNION}" "${NEW_ROOT}/${FS_LOCATION}" + + # setup internal mounts + mkdir -p "${UNION}/mnt/livecd" + if [ ! -e "${UNION}/mnt/cdrom" ]; then + mkdir "${UNION}/mnt/cdrom" -p + fi + mount --bind "${NEW_ROOT}/${FS_LOCATION}" "${UNION}/mnt/livecd" + mount --bind "${NEW_ROOT}/mnt/cdrom" "${UNION}/mnt/cdrom" + + # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs + sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' "/${UNION}/etc/fstab" > "/${UNION}/etc/fstab.new" + mv "/${UNION}/etc/fstab.new" "/${UNION}/etc/fstab" + +} + setup_unionfs() { local rw_dir=$1 local ro_dir=$2 |