Added unionfs patches from bug #121334.
authorChris Gianelloni <wolf31o2@gentoo.org>
Thu, 13 Apr 2006 15:31:45 +0000 (15:31 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Thu, 13 Apr 2006 15:31:45 +0000 (15:31 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@374 67a159dc-881f-0410-a524-ba9dfbe2cb84

generic/initrd.scripts
generic/linuxrc

index c4d9b9016b1f734c1c2e9a9223025496339a0bdb..c78e52c9e10e255a9cd768fc6600d23f747a334e 100644 (file)
@@ -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"
index 73c748dd19be925f7e84baf0173506092888eef8..dd49dc881ae999d3162809e6316dc6c831591d0f 100644 (file)
@@ -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