From 132905237ecb314f98d25b8f278ca40bf02ae311 Mon Sep 17 00:00:00 2001 From: Eric Edgar Date: Tue, 19 Jul 2005 14:33:17 +0000 Subject: [PATCH] Fix --no-install cleaning the tmpdir bug that plasmaroo reported git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@274 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_compile.sh | 12 ++++++------ gen_funcs.sh | 16 +++++++++++++++- gen_initramfs.sh | 4 ++-- gen_initrd.sh | 18 +++++++++--------- generic/linuxrc | 4 ++-- genkernel | 12 +++++++----- 6 files changed, 41 insertions(+), 25 deletions(-) diff --git a/gen_compile.sh b/gen_compile.sh index 3251e54..fa98c4e 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -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 } diff --git a/gen_funcs.sh b/gen_funcs.sh index fd6763f..3e0aa5e 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -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 +} diff --git a/gen_initramfs.sh b/gen_initramfs.sh index a122864..0fa363a 100644 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -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 } diff --git a/gen_initrd.sh b/gen_initrd.sh index f6753cb..fb62702 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -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 } diff --git a/generic/linuxrc b/generic/linuxrc index 2169f5b..da21c2f 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -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 ;; diff --git a/genkernel b/genkernel index 4b008ab..0d7e9d3 100755 --- 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 -- 2.26.2