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
cleanup-cruft
Eric Edgar 20 years ago
parent 9c81567e47
commit 132905237e

@ -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
}

@ -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
}

@ -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
}

@ -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
}

@ -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

Loading…
Cancel
Save