Fix exit 1 issue being always called. Add UID support for unionfs. add check for...
authorEric Edgar <rocket@gentoo.org>
Tue, 19 Jul 2005 15:38:58 +0000 (15:38 +0000)
committerEric Edgar <rocket@gentoo.org>
Tue, 19 Jul 2005 15:38:58 +0000 (15:38 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@275 67a159dc-881f-0410-a524-ba9dfbe2cb84

generic/initrd.scripts
generic/linuxrc
genkernel

index db9b685782764b94067f6bb86bdd72cbd398c896..adac1f5c991455652c21a323aae0be6f206e97e3 100644 (file)
@@ -539,7 +539,13 @@ setup_unionfs(){
                # Directory used for rw changes in union mount filesystem
                UNION=/union
                MEMORY=/memory
-               CHANGES=$MEMORY/changes
+               if [ -n "$UID" ]
+               then
+                       CHANGES=$MEMORY/unionfs_changes/default
+               else
+                       CHANGES=$MEMORY/unionfs_changes/$UID
+               fi
+
                
                mkdir -p ${MEMORY}
                mkdir -p ${UNION}
@@ -558,6 +564,14 @@ 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 ]
+                       then
+                               umount $CHANGESDEV
+                               bad_msg "failed to find livecd.unionfs file on $CHANGESDEV"
+                               bad_msg "falling back to ramdisk based unionfs for safety"
+                               bad_msg "create a livecd.unionfs file on this device if you wish to use it for unionfs"
+                               mount -t tmpfs tmpfs $MEMORY
+                       fi
                else 
                        good_msg "Mounting ramdisk to $MEMORY for unionfs support..."
                        mount -t tmpfs tmpfs $MEMORY 
index da21c2faf879c95ff9260e9976aa07a5d1bc6cb3..3092517f533a4f8352b153a92e99ee196ee41d80 100644 (file)
@@ -100,7 +100,15 @@ do
              bad_msg 'Unionctl not found: aborting use of unionfs!'
          else
                USE_UNIONFS_NORMAL=1
-               UNIONFS=`parse_opt "${x}"`
+               CMD_UNIONFS=`parse_opt "${x}"`
+               echo ${CMD_UNIONFS}|grep , >/dev/null 2>&1
+               if [ "$?" -eq '0' ]
+               then
+                       UID=`echo ${CMD_UNIONFS#*,}`
+                       UNIONFS=`echo ${CMD_UNIONFS%,*}`
+               else
+                       UNIONFS=${CMD_UNIONFS}
+               fi
          fi
          ;;
 
index 0d7e9d38b8e22b98d7f8c5c00788241b568bb5af..ac634305d09f794e1fb2d63bac3f103deee59dce 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -27,6 +27,12 @@ source ${GK_BIN}/gen_bootloader.sh || gen_die "Could not read ${GK_BIN}/gen_boot
 
 TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
 
+trap_cleanup(){
+       #Call exit code of 1 for failure
+       cleanup
+       exit 1
+}
+
 cleanup(){
     if [ -n "$TEMP" -a -d "$TEMP" ]; then
        rm -rf "$TEMP"
@@ -47,10 +53,9 @@ cleanup(){
            print_info 1 "TMPDIR: ${TMPDIR}"
            clear_tmpdir
            fi
-
-    exit 1
 }
-trap cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL
+
+trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL
 BUILD_KERNEL=0
 BUILD_INITRD=0
 BUILD_MODULES=0