Clean up clean up
This commit is contained in:
parent
c0a5b85f8f
commit
6c146a7bb7
6 changed files with 30 additions and 20 deletions
|
@ -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/
|
||||
|
|
|
@ -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 <<EOF
|
||||
fdisk -H 255 -S 63 ${IMG_FILE} <<EOF
|
||||
o
|
||||
n
|
||||
|
||||
|
||||
8192
|
||||
+`expr $BOOT_SIZE \* 3`M
|
||||
+$((BOOT_SIZE * 2 /512))
|
||||
p
|
||||
t
|
||||
c
|
||||
|
@ -57,4 +57,4 @@ mount -v $ROOT_DEV ${ROOTFS_DIR} -t ext4
|
|||
mkdir -p ${ROOTFS_DIR}/boot
|
||||
mount -v $BOOT_DEV ${ROOTFS_DIR}/boot -t vfat
|
||||
|
||||
rsync -aHAXx ${EXPORT_ROOTFS_DIR}/ ${ROOTFS_DIR}/
|
||||
rsync -aHAXx --exclude var/cache/apt/archives ${EXPORT_ROOTFS_DIR}/ ${ROOTFS_DIR}/
|
||||
|
|
|
@ -28,7 +28,7 @@ copy_previous(){
|
|||
false
|
||||
fi
|
||||
mkdir -p "${ROOTFS_DIR}"
|
||||
rsync -aHAXx "${PREV_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
|
||||
rsync -aHAXx --exclude var/cache/apt/archives "${PREV_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
|
||||
}
|
||||
export -f copy_previous
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
on_chroot << EOF
|
||||
apt-get clean
|
||||
EOF
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
rm -f "${ROOTFS_DIR}/root/.vnc/private.key"
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
on_chroot << EOF
|
||||
apt-get clean
|
||||
EOF
|
Loading…
Reference in a new issue