1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
raspberrypi-build/export-image/04-finalise/01-run.sh

61 lines
1.5 KiB
Bash
Raw Normal View History

2016-05-05 14:43:33 -04:00
#!/bin/bash -e
2017-07-02 05:32:52 -04:00
IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}.img"
2016-05-05 14:43:33 -04:00
on_chroot << EOF
2016-05-05 14:43:33 -04:00
/etc/init.d/fake-hwclock stop
2016-05-19 14:45:54 -04:00
hardlink -t /usr/share/doc
2016-05-05 14:43:33 -04:00
EOF
if [ -d ${ROOTFS_DIR}/home/$USERNAME/.config ]; then
chmod 700 ${ROOTFS_DIR}/home/$USERNAME/.config
2016-11-06 09:46:27 -05:00
fi
2016-05-05 14:43:33 -04:00
rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache
rm -f ${ROOTFS_DIR}/usr/sbin/policy-rc.d
rm -f ${ROOTFS_DIR}/usr/bin/qemu-arm-static
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
2017-03-30 12:51:23 -04:00
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
2017-05-15 11:40:31 -04:00
ln -nsf /proc/mounts ${ROOTFS_DIR}/etc/mtab
2017-03-30 12:51:23 -04:00
for _FILE in $(find ${ROOTFS_DIR}/var/log/ -type f); do
true > ${_FILE}
done
rm -f "${ROOTFS_DIR}/root/.vnc/private.key"
2016-05-05 14:43:33 -04:00
ROOT_DEV=$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')
unmount ${ROOTFS_DIR}
zerofree -v ${ROOT_DEV}
unmount_image ${IMG_FILE}
mkdir -p ${DEPLOY_DIR}
2017-07-02 05:32:52 -04:00
rm -f ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}.zip
2016-05-05 14:43:33 -04:00
2017-07-02 05:32:52 -04:00
echo zip ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}.zip ${IMG_FILE}
2016-05-05 14:43:33 -04:00
pushd ${STAGE_WORK_DIR} > /dev/null
2017-07-02 05:32:52 -04:00
zip ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}.zip $(basename ${IMG_FILE})
2016-05-05 14:43:33 -04:00
popd > /dev/null