Moving removal of backup and temporary files to their own hook script.

This commit is contained in:
Daniel Baumann 2012-12-16 23:56:34 +01:00
parent 21ac95b9a6
commit 7caf9ed19f
4 changed files with 32 additions and 19 deletions

View File

@ -612,7 +612,9 @@ Set_defaults ()
remove-linux-image-backups \ remove-linux-image-backups \
remove-mdadm-configuration \ remove-mdadm-configuration \
remote-adjtime-configuration \ remote-adjtime-configuration \
disable-kexec-tools}" disable-kexec-tools \
remove-backup-files \
remove-temporary-files}"
;; ;;
kubuntu) kubuntu)
@ -627,7 +629,9 @@ Set_defaults ()
remove-linux-image-backups \ remove-linux-image-backups \
remove-mdadm-configuration \ remove-mdadm-configuration \
remove-adjtime-configuration \ remove-adjtime-configuration \
disable-kexec-tools}" disable-kexec-tools \
remove-backup-files \
remove-temporary-files}"
;; ;;
esac esac

View File

@ -104,23 +104,6 @@ case "${LB_INITRAMFS_COMPRESSION}" in
;; ;;
esac esac
# Remove cruft
rm -f chroot/boot/initrd*bak*
rm -f chroot/etc/apt/trusted.gpg~
rm -f chroot/etc/group- chroot/etc/passwd-
rm -f chroot/etc/gshadow- chroot/etc/shadow-
rm -f chroot/var/cache/debconf/*-old
rm -f chroot/var/lib/dpkg/*-old
rm -f chroot/var/log/apt/term.log
# Delete and re-create temporary directories
TEMP_DIRS="/tmp /var/tmp"
for DIR in ${TEMP_DIRS}
do
rm -rf "chroot/${DIR}"
install -d -m 1777 "chroot/${DIR}"
done
if [ -n "${LB_ROOT_COMMAND}" ] if [ -n "${LB_ROOT_COMMAND}" ]
then then
${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot ${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
# Remove backup files
rm -f /etc/apt/trusted.gpg~
rm -f /etc/passwd-
rm -f /etc/group-
rm -f /etc/shadow-
rm -f /etc/gshadow-
rm -f /var/cache/debconf/*-old
rm -f /var/lib/dpkg/*-old

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
# Remove temporary files
for _DIRECTORY in /tmp /var/tmp
do
rm -rf ${_DIRECTORY}
mkdir -p ${_DIRECTORY}
chmod 1777 ${_DIRECTORY}
done