Fix --no-install cleaning the tmpdir bug that plasmaroo reported
authorEric Edgar <rocket@gentoo.org>
Tue, 19 Jul 2005 14:33:17 +0000 (14:33 +0000)
committerEric Edgar <rocket@gentoo.org>
Tue, 19 Jul 2005 14:33:17 +0000 (14:33 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@274 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_compile.sh
gen_funcs.sh
gen_initramfs.sh
gen_initrd.sh
generic/linuxrc
genkernel

index 3251e543c66e453ec24042e2cdf980f05178c331..fa98c4eb41f4463af9f085d338f3f20a7eef61b9 100644 (file)
@@ -241,14 +241,14 @@ compile_kernel() {
                                gen_die 'Could not copy the kernelz binary to /boot!'
                fi
        else
-               cp "${KERNEL_BINARY}" "${TEMP}/kernel-${KNAME}-${ARCH}-${KV}" ||
-                       gen_die "Could not copy the kernel binary to ${TEMP}!"
-               cp "System.map" "${TEMP}/System.map-${KNAME}-${ARCH}-${KV}" ||
-                       gen_die "Could not copy System.map to ${TEMP}!"
+               cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
+                       gen_die "Could not copy the kernel binary to ${TMPDIR}!"
+               cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
+                       gen_die "Could not copy System.map to ${TMPDIR}!"
                if [ "${KERNEL_BINARY_2}" != '' ]
                then
-                       cp "${KERNEL_BINARY_2}" "${TEMP}/kernelz-${KV}" ||
-                               gen_die "Could not copy the kernelz binary to ${TEMP}!"
+                       cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
+                               gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
                fi
        fi
 }
index fd6763f1c5d0ae3905d4cef89c9624792a747626..3e0aa5e3ee4419de3111ac09ce67e1b866bef484 100755 (executable)
@@ -227,10 +227,10 @@ gen_die() {
        print_info 1 ''
        print_info 1 'Please do *not* report compilation failures as genkernel bugs!'
        print_info 1 ''
-       exit 1
 
        # Cleanup temp dirs and caches if requested
        cleanup
+       exit 1
 }
 
 has_loop() {
@@ -266,6 +266,7 @@ if [ "${CLEAR_CACHE_DIR}" == 'yes' ]
 then
        print_info 1 "Clearing cache dir contents from ${CACHE_DIR}"
        CACHE_DIR_CONTENTS=`ls ${CACHE_DIR}|grep -v CVS|grep -v cpio|grep -v README`
+       
        for i in ${CACHE_DIR_CONTENTS}
        do
                print_info 1 "   >> removing ${i}"
@@ -275,3 +276,16 @@ fi
 
 }
 
+clear_tmpdir()
+{
+if ! isTrue ${CMD_NOINSTALL}
+then
+    TMPDIR_CONTENTS=`ls ${TMPDIR}`
+    print_info 1 "Removing tmp dir contents"
+    for i in ${TMPDIR_CONTENTS}
+    do
+       print_info 1 "   >> removing ${i}"
+       rm ${TMPDIR}/${i}
+    done
+fi
+}      
index a122864c99979f150feadc5391bc0d50c0f25aee..0fa363a02bc3fae4f956637ab062b1f6d25c8a52 100644 (file)
@@ -491,7 +491,7 @@ merge_initramfs_cpio_archives(){
                echo "    $i"
        done
 
-       cat ${MERGE_LIST} > ${TEMP}/initramfs-${KV}
+       cat ${MERGE_LIST} > ${TMPDIR}/initramfs-${KV}
 
        [ "${KERNEL_MAKE_DIRECTIVE}" == 'zImage.initrd' ] ||
                [ "${KERNEL_MAKE_DIRECTIVE_2}" == 'zImage.initrd' ] &&
@@ -604,7 +604,7 @@ create_initramfs() {
 
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               cp ${TEMP}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} ||
+               cp ${TMPDIR}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} ||
                        gen_die 'Could not copy the initramfs to /boot!'
        fi
 }
index f6753cb929ebe4a41e21695c498aaf98070f12f0..fb62702fa171e9f3f3d00f6c58a139dede568254 100644 (file)
@@ -6,11 +6,11 @@ create_initrd_loop() {
        [ "$#" -ne '1' ] && gen_die 'create_initrd_loop(): Not enough arguments!'
        mkdir -p ${TEMP}/initrd-mount ||
                gen_die 'Could not create loopback mount directory!'
-       dd if=/dev/zero of=${TEMP}/initrd-${KV} bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 ||
+       dd if=/dev/zero of=${TMPDIR}/initrd-${KV} bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 ||
                gen_die "Could not zero initrd-${KV}"
-       mke2fs -F -N500 -q "${TEMP}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 ||
+       mke2fs -F -N500 -q "${TMPDIR}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 ||
                gen_die "Could not format initrd-${KV}!"
-       mount -t ext2 -o loop "${TEMP}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 ||
+       mount -t ext2 -o loop "${TMPDIR}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 ||
                gen_die 'Could not mount the initrd filesystem!'
 }
 
@@ -89,7 +89,7 @@ create_base_initrd_sys() {
        fi
 
        # devfsd
-       if [ "${NODEVFSD}" = '' ]
+       if [ "${UDEV}" != '1' ]
        then
                cp "${DEVFSD_BINCACHE}" "${TEMP}/initrd-temp/bin/devfsd.bz2" || gen_die 'Could not copy devfsd executable from bincache!'
                bunzip2 "${TEMP}/initrd-temp/bin/devfsd.bz2" || gen_die 'Could not uncompress devfsd!'
@@ -340,8 +340,8 @@ create_initrd() {
 
        if [ "${COMPRESS_INITRD}" ]
        then
-               gzip -f -9 ${TEMP}/initrd-${KV}
-               mv ${TEMP}/initrd-${KV}.gz ${TEMP}/initrd-${KV}
+               gzip -f -9 ${TMPDIR}/initrd-${KV}
+               mv ${TMPDIR}/initrd-${KV}.gz ${TMPDIR}/initrd-${KV}
        fi
 
        if [ "${BOOTSPLASH}" -eq "1" ]
@@ -356,7 +356,7 @@ create_initrd() {
                        do
                                if [ -f "/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg" ]
                                then
-                                       /sbin/splash -s -f /etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg >> ${TEMP}/initrd-${KV} ||
+                                       /sbin/splash -s -f /etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg >> ${TMPDIR}/initrd-${KV} ||
                                                gen_die "Error: could not copy ${bootRes} bootsplash!"
                                else
                                        print_warning 1 "splash: Did not find a bootsplash for the ${bootRes} resolution..."
@@ -368,10 +368,10 @@ create_initrd() {
        fi
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               cp ${TEMP}/initrd-${KV} /boot/initrd-${KNAME}-${ARCH}-${KV} ||
+               cp ${TMPDIR}/initrd-${KV} /boot/initrd-${KNAME}-${ARCH}-${KV} ||
                        gen_die 'Could not copy the initrd to /boot!'
        fi
        [ "${KERNEL_MAKE_DIRECTIVE}" == 'zImage.initrd' ] ||
                [ "${KERNEL_MAKE_DIRECTIVE_2}" == 'zImage.initrd' ] &&
-               cp ${TEMP}/initrd-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz
+               cp ${TMPDIR}/initrd-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz
 }
index 2169f5bce4751841c77df3b01a13f19737ba0c49..da21c2faf879c95ff9260e9976aa07a5d1bc6cb3 100644 (file)
@@ -99,8 +99,8 @@ do
              USE_UNIONFS_NORMAL=0
              bad_msg 'Unionctl not found: aborting use of unionfs!'
          else
-             USE_UNIONFS_NORMAL=1
-             UNIONFS=`parse_opt "${x}"`
+               USE_UNIONFS_NORMAL=1
+               UNIONFS=`parse_opt "${x}"`
          fi
          ;;
 
index 4b008abc0e855f3b3e8d171dbe771c44e8e9be2c..0d7e9d38b8e22b98d7f8c5c00788241b568bb5af 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -4,7 +4,7 @@
 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
 GK_V='3.2.7'
 
-TEMP='/var/tmp/genkernel'
+TMPDIR='/var/tmp/genkernel'
 TODEBUGCACHE=1 # Until an error occurs or DEBUGFILE is fully qualified.
 
 small_die() {
@@ -25,7 +25,7 @@ source ${GK_BIN}/gen_moddeps.sh || gen_die "Could not read ${GK_BIN}/gen_moddeps
 source ${GK_BIN}/gen_package.sh || gen_die "Could not read ${GK_BIN}/gen_package.sh"
 source ${GK_BIN}/gen_bootloader.sh || gen_die "Could not read ${GK_BIN}/gen_bootloader.sh"
 
-TEMP=${TEMP}/$RANDOM.$RANDOM.$RANDOM.$$
+TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
 
 cleanup(){
     if [ -n "$TEMP" -a -d "$TEMP" ]; then
@@ -34,16 +34,18 @@ cleanup(){
 
     if isTrue ${POSTCLEAR}
     then
-            print_info 1 ''
+           echo
            print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
            print_info 1 "CACHE_DIR: ${CACHE_DIR}"
            CLEAR_CACHE_DIR='yes'
            setup_cache_dir
-           ls -la ${CACHE_DIR}
+           echo
            print_info 1 "CACHE_CPIO_DIR: ${CACHE_CPIO_DIR}"
            CLEAR_CPIO_CACHE='yes'
            clear_cpio_dir
-           ls -la ${CACHE_CPIO_DIR}
+           echo
+           print_info 1 "TMPDIR: ${TMPDIR}"
+           clear_tmpdir
            fi
 
     exit 1