diff options
author | Daniel Baumann <daniel@debian.org> | 2012-12-16 23:56:34 +0100 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2013-05-06 14:50:02 +0200 |
commit | fae7a1ce27a04d0756e2c64300b64193bd9d4147 (patch) | |
tree | dfd34703d9cc2d8bde6a00bf2d700f087f6cd865 | |
parent | c02300e297dd01301832ad3ba7f464b2b2c257ce (diff) | |
download | vyos-live-build-fae7a1ce27a04d0756e2c64300b64193bd9d4147.tar.gz vyos-live-build-fae7a1ce27a04d0756e2c64300b64193bd9d4147.zip |
Moving removal of backup and temporary files to their own hook script.
-rwxr-xr-x | functions/defaults.sh | 8 | ||||
-rwxr-xr-x | scripts/build/chroot_hacks | 17 | ||||
-rwxr-xr-x | share/hooks/0140-remove-backup-files.chroot | 14 | ||||
-rwxr-xr-x | share/hooks/0150-remove-temporary-files.chroot | 12 |
4 files changed, 32 insertions, 19 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh index f4f0c86f2..f708f5925 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -612,7 +612,9 @@ Set_defaults () remove-linux-image-backups \ remove-mdadm-configuration \ remote-adjtime-configuration \ - disable-kexec-tools}" + disable-kexec-tools \ + remove-backup-files \ + remove-temporary-files}" ;; kubuntu) @@ -627,7 +629,9 @@ Set_defaults () remove-linux-image-backups \ remove-mdadm-configuration \ remove-adjtime-configuration \ - disable-kexec-tools}" + disable-kexec-tools \ + remove-backup-files \ + remove-temporary-files}" ;; esac diff --git a/scripts/build/chroot_hacks b/scripts/build/chroot_hacks index a440ed195..a30f83054 100755 --- a/scripts/build/chroot_hacks +++ b/scripts/build/chroot_hacks @@ -104,23 +104,6 @@ case "${LB_INITRAMFS_COMPRESSION}" in ;; 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}" ] then ${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot diff --git a/share/hooks/0140-remove-backup-files.chroot b/share/hooks/0140-remove-backup-files.chroot new file mode 100755 index 000000000..6058f1eb2 --- /dev/null +++ b/share/hooks/0140-remove-backup-files.chroot @@ -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 diff --git a/share/hooks/0150-remove-temporary-files.chroot b/share/hooks/0150-remove-temporary-files.chroot new file mode 100755 index 000000000..21bc5ee6f --- /dev/null +++ b/share/hooks/0150-remove-temporary-files.chroot @@ -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 |