From: Chris Gianelloni Date: Thu, 13 Apr 2006 15:31:45 +0000 (+0000) Subject: Added unionfs patches from bug #121334. X-Git-Tag: v3.4.10.902~378 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=accba45515b434809fc7c3b11683524123fd390c;p=genkernel.git Added unionfs patches from bug #121334. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@374 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/generic/initrd.scripts b/generic/initrd.scripts index c4d9b90..c78e52c 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -572,7 +572,7 @@ setup_unionfs() { # Directory used for rw changes in union mount filesystem UNION=/union MEMORY=/memory - if [ -n "$UID" ] + if [ -z "$UID" ] then CHANGES=$MEMORY/unionfs_changes/default else @@ -596,9 +596,9 @@ setup_unionfs() { bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based unionfs" mount -t tmpfs tmpfs $MEMORY fi - if [ ! -f ${MEMORY}/livecd.unionfs ] + if [ "${CDROOT}" -eq '1' -a ! -f ${MEMORY}/livecd.unionfs ] then - umount $CHANGESDEV + umount $MEMORY bad_msg "failed to find livecd.unionfs file on $CHANGESDEV" bad_msg "create a livecd.unionfs file on this device if you wish to use it for unionfs" bad_msg "falling back to ramdisk based unionfs for safety" diff --git a/generic/linuxrc b/generic/linuxrc index 73c748d..dd49dc8 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -533,7 +533,7 @@ then if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] then - union_insert_dir $UNION /${NEW_ROOT}/${FS_LOCATION} + union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION} # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on unionfs dirs. sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new @@ -619,7 +619,13 @@ then CDBOOT=1 [ "${DO_slowusb}" ] && sleep 10 else - mkdir -p ${NEW_ROOT}/tmp/.initrd + if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] + then + union_insert_dir ${UNION} ${NEW_ROOT} + mkdir -p ${UNION}/tmp/.initrd + else + mkdir -p ${NEW_ROOT}/tmp/.initrd + fi fi # Execute script on the cdrom just before boot to update things if necessary @@ -633,6 +639,17 @@ fi verbose_kmsg +# Move the /memory mount point to what will be the system root so that +# init scripts will be able to unmount it properly at next reboot +# +# Eventually, all "unions over /" mounts should go in that /.unions/ +if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] +then + mkdir -p /${CHROOT}/.unions/memory 2>/dev/null + mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move unionfs /memory into the system root!' +fi + + if [ "$0" = '/linuxrc' ] then [ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1