Browse Source

Clean up clean up

pull/68/head
Serge Schneider 4 years ago
parent
commit
6c146a7bb7
6 changed files with 30 additions and 20 deletions
  1. +23
    -0
      export-image/04-finalise/01-run.sh
  2. +6
    -6
      export-image/prerun.sh
  3. +1
    -1
      scripts/common
  4. +0
    -5
      stage2/03-cleanup/00-run.sh
  5. +0
    -3
      stage4/00-install-packages/01-run.sh
  6. +0
    -5
      stage4/03-cleanup/00-run.sh

+ 23
- 0
export-image/04-finalise/01-run.sh View File

@ -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/

+ 6
- 6
export-image/prerun.sh View File

@ -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}/

+ 1
- 1
scripts/common View File

@ -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

+ 0
- 5
stage2/03-cleanup/00-run.sh View File

@ -1,5 +0,0 @@
#!/bin/bash -e
on_chroot << EOF
apt-get clean
EOF

+ 0
- 3
stage4/00-install-packages/01-run.sh View File

@ -1,3 +0,0 @@
#!/bin/bash -e
rm -f "${ROOTFS_DIR}/root/.vnc/private.key"

+ 0
- 5
stage4/03-cleanup/00-run.sh View File

@ -1,5 +0,0 @@
#!/bin/bash -e
on_chroot << EOF
apt-get clean
EOF

Loading…
Cancel
Save