From 6c146a7bb791a8a4b43ac71061994fb6fe54cee5 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Thu, 30 Mar 2017 17:51:23 +0100 Subject: [PATCH] Clean up clean up --- export-image/04-finalise/01-run.sh | 23 +++++++++++++++++++++++ export-image/prerun.sh | 12 ++++++------ scripts/common | 2 +- stage2/03-cleanup/00-run.sh | 5 ----- stage4/00-install-packages/01-run.sh | 3 --- stage4/03-cleanup/00-run.sh | 5 ----- 6 files changed, 30 insertions(+), 20 deletions(-) delete mode 100755 stage2/03-cleanup/00-run.sh delete mode 100755 stage4/00-install-packages/01-run.sh delete mode 100755 stage4/03-cleanup/00-run.sh diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index c64c92b..2de42ca 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -18,6 +18,29 @@ if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then mv ${ROOTFS_DIR}/etc/ld.so.preload.disabled ${ROOTFS_DIR}/etc/ld.so.preload fi +rm -f ${ROOTFS_DIR}/etc/apt/sources.list~ +rm -f ${ROOTFS_DIR}/etc/apt/trusted.gpg~ + +rm -f ${ROOTFS_DIR}/etc/passwd- +rm -f ${ROOTFS_DIR}/etc/group- +rm -f ${ROOTFS_DIR}/etc/shadow- +rm -f ${ROOTFS_DIR}/etc/gshadow- + +rm -f ${ROOTFS_DIR}/var/cache/debconf/*-old +rm -f ${ROOTFS_DIR}/var/lib/dpkg/*-old + +rm -f ${ROOTFS_DIR}/usr/share/icons/*/icon-theme.cache + +rm -f ${ROOTFS_DIR}/var/lib/dbus/machine-id + +true > ${ROOTFS_DIR}/etc/machine-id + +for _FILE in $(find ${ROOTFS_DIR}/var/log/ -type f); do + true > ${_FILE} +done + +rm -f "${ROOTFS_DIR}/root/.vnc/private.key" + update_issue $(basename ${EXPORT_DIR}) install -m 644 ${ROOTFS_DIR}/etc/rpi-issue ${ROOTFS_DIR}/boot/issue.txt install files/LICENSE.oracle ${ROOTFS_DIR}/boot/ diff --git a/export-image/prerun.sh b/export-image/prerun.sh index ec440c9..661fc4e 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -8,19 +8,19 @@ rm -f ${IMG_FILE} rm -rf ${ROOTFS_DIR} mkdir -p ${ROOTFS_DIR} -BOOT_SIZE=$(du -sh ${EXPORT_ROOTFS_DIR}/boot -B M | cut -f 1 | tr -d M) -TOTAL_SIZE=$(du -sh ${EXPORT_ROOTFS_DIR} -B M | cut -f 1 | tr -d M) +BOOT_SIZE=$(du -s ${EXPORT_ROOTFS_DIR}/boot --block-size=1 | cut -f 1) +TOTAL_SIZE=$(du -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/archives --block-size=1 | cut -f 1) -IMG_SIZE=$(expr $BOOT_SIZE \* 2 \+ $TOTAL_SIZE \+ 512)M +IMG_SIZE=$((BOOT_SIZE + TOTAL_SIZE + (400 * 1024 * 1024))) fallocate -l ${IMG_SIZE} ${IMG_FILE} -fdisk ${IMG_FILE} > /dev/null 2>&1 <