summaryrefslogtreecommitdiff
path: root/export-image/prerun.sh
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.org>2017-03-30 17:51:23 +0100
committerSerge Schneider <serge@raspberrypi.org>2017-04-03 16:01:13 +0100
commit6c146a7bb791a8a4b43ac71061994fb6fe54cee5 (patch)
treee45cec9d1d3ee5494d7b8af91077cab65ef4ac3b /export-image/prerun.sh
parentc0a5b85f8fcea38d2203fda140ce12ad134e08f3 (diff)
Clean up clean up
Diffstat (limited to 'export-image/prerun.sh')
-rwxr-xr-xexport-image/prerun.sh12
1 files changed, 6 insertions, 6 deletions
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 <<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}/