aboutsummaryrefslogtreecommitdiffstats
path: root/export-image
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-07-04 02:45:44 +0200
committerSven Gothel <[email protected]>2021-07-04 02:45:44 +0200
commit538fa0ec2917a9005bd725ea7ef25da689b35342 (patch)
treea709295a5fa8a4a023420137b29a8caa637d8292 /export-image
parent0ea47789ea7e119df958a8a7d248e5e1db79bc31 (diff)
ROOTFS_RO: export_image: Cleanup and consider read-only or mutable rootfs...
Also move the `/data/sdcard` copy of '/boot' to stage2 and custom stages, only used in ROOTFS_RO.
Diffstat (limited to 'export-image')
-rwxr-xr-xexport-image/04-finalise/01-run.sh101
1 files changed, 36 insertions, 65 deletions
diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh
index 71cc614..abb0a91 100755
--- a/export-image/04-finalise/01-run.sh
+++ b/export-image/04-finalise/01-run.sh
@@ -8,7 +8,7 @@ elif [ "${DEPLOY_DIR}" = "/" ] ; then
exit 1
fi
-DEPLOY_DIR2="${DEPLOY_DIR}/${IMG_FILENAME}-${STAGE}"
+DEPLOY_DIR2="${DEPLOY_DIR}/${IMG_FILENAME}"
IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info"
@@ -18,10 +18,6 @@ IMG_FILE_ROOT_SQFS_GZ="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_
IMG_FILE_ROOT_SQFS_LZO="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_lzo.img"
IMG_FILE_ROOT_SQFS_NONE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root-sqfs_none.img"
INFO_FILE_ROOT="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.root.info"
-#IMG_FILE_BOOT="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.boot.img"
-#INFO_FILE_BOOT="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.boot.info"
-#IMG_FILE_DATA="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.data.img"
-#INFO_FILE_DATA="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.data.info"
on_chroot << EOF
if [ -x /etc/init.d/fake-hwclock ]; then
@@ -85,80 +81,55 @@ install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"
cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
-cp "$INFO_FILE" "$INFO_FILE_ROOT"
-#cp "$INFO_FILE" "$INFO_FILE_BOOT"
-#cp "$INFO_FILE" "$INFO_FILE_DATA"
-
-echo >> "$INFO_FILE_ROOT"
-echo "+++" >> "$INFO_FILE_ROOT"
-echo >> "$INFO_FILE_ROOT"
-echo "Root Partition `basename $IMG_FILE_ROOT_EXT4`" >> "$INFO_FILE_ROOT"
-echo "Root Partition of `basename $IMG_FILE`" >> "$INFO_FILE_ROOT"
-echo >> "$INFO_FILE_ROOT"
-
-#echo >> "$INFO_FILE_BOOT"
-#echo "+++" >> "$INFO_FILE_BOOT"
-#echo >> "$INFO_FILE_BOOT"
-#echo "Boot Partition `basename $IMG_FILE_BOOT`" >> "$INFO_FILE_BOOT"
-#echo "Boot Partition of `basename $IMG_FILE`" >> "$INFO_FILE_BOOT"
-#echo >> "$INFO_FILE_BOOT"
-
-#echo >> "$INFO_FILE_DATA"
-#echo "+++" >> "$INFO_FILE_DATA"
-#echo >> "$INFO_FILE_DATA"
-#echo "Data Partition `basename $IMG_FILE_DATA`" >> "$INFO_FILE_DATA"
-#echo "Data Partition of `basename $IMG_FILE`" >> "$INFO_FILE_DATA"
-#echo >> "$INFO_FILE_DATA"
+if [ "${ROOTFS_RO}" = "1" ] ; then
+ cp "$INFO_FILE" "$INFO_FILE_ROOT"
+ echo >> "$INFO_FILE_ROOT"
+ echo "+++" >> "$INFO_FILE_ROOT"
+ echo >> "$INFO_FILE_ROOT"
+ echo "Root Partition `basename $IMG_FILE_ROOT_EXT4`" >> "$INFO_FILE_ROOT"
+ echo "Root Partition of `basename $IMG_FILE`" >> "$INFO_FILE_ROOT"
+ echo >> "$INFO_FILE_ROOT"
+fi
rm -rf "${DEPLOY_DIR2}"
mkdir -p "${DEPLOY_DIR2}"
-cp -a "${ROOTFS_DIR}/boot" "${DEPLOY_DIR2}/sdcard"
-mkdir -p "${ROOTFS_DIR}/data/sdcard/zafena/data"
-find "${ROOTFS_DIR}/boot/" -maxdepth 1 -type f \
- -exec cp -d --preserve=all \{\} "${ROOTFS_DIR}/data/sdcard/" \;
-cp -a "${ROOTFS_DIR}/boot/sys_arm64_000" "${ROOTFS_DIR}/data/sdcard/"
-cp -a "${ROOTFS_DIR}/boot/zafena/etc" "${ROOTFS_DIR}/data/sdcard/zafena/"
+
+if [ "${ROOTFS_RO}" = "1" ] ; then
+ cp -a "${ROOTFS_DIR}/boot" "${DEPLOY_DIR2}/sdcard-${STAGE}"
+fi
unload_qimage
make_bootable_image "${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.qcow2" \
"$IMG_FILE" \
"$IMG_FILE_ROOT_EXT4" "$INFO_FILE_ROOT"
-# "$IMG_FILE_BOOT" "$INFO_FILE_BOOT" \
-# "$IMG_FILE_DATA" "$INFO_FILE_DATA"
-
-
-mount -o ro "$IMG_FILE_ROOT_EXT4" "${ROOTFS_DIR}"
-mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_GZ}" -comp gzip
-mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_LZO}" -comp lzo
-mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_NONE}" -noI -noD -noF -noX
-umount "${ROOTFS_DIR}"
-
-cp -a "$INFO_FILE_ROOT" "${DEPLOY_DIR2}/sdcard/sys_arm64_000/rootfs.inf"
+if [ "${ROOTFS_RO}" = "1" ] ; then
+ mount -o ro "$IMG_FILE_ROOT_EXT4" "${ROOTFS_DIR}"
+ mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_GZ}" -comp gzip
+ mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_LZO}" -comp lzo
+ mksquashfs "${ROOTFS_DIR}" "${IMG_FILE_ROOT_SQFS_NONE}" -noI -noD -noF -noX
+ umount "${ROOTFS_DIR}"
+ cp -a "$INFO_FILE_ROOT" "${DEPLOY_DIR2}/sdcard-${STAGE}/sys_arm64_000/rootfs.inf"
+fi
mv "$INFO_FILE" "$INFO_FILE_ROOT" "$DEPLOY_DIR2/"
-#mv "$INFO_FILE" "$INFO_FILE_ROOT" "$INFO_FILE_BOOT" "$INFO_FILE_DATA" "$DEPLOY_DIR2/"
if [ "${DEPLOY_ZIP}" == "1" ]; then
gzip -k "$IMG_FILE"
- gzip -k "$IMG_FILE_ROOT_EXT4"
- #gzip -k "$IMG_FILE_BOOT"
- #gzip -k "$IMG_FILE_DATA"
- mv "$IMG_FILE".gz "$DEPLOY_DIR2/"
- mv "$IMG_FILE_ROOT_EXT4".gz "$DEPLOY_DIR2/"
- #mv "$IMG_FILE_BOOT".gz "$DEPLOY_DIR2/"
- #mv "$IMG_FILE_DATA".gz "$DEPLOY_DIR2/"
+ mv "$IMG_FILE".gz "$DEPLOY_DIR2/"
+ if [ "${ROOTFS_RO}" = "1" ] ; then
+ gzip -k "$IMG_FILE_ROOT_EXT4"
+ mv "$IMG_FILE_ROOT_EXT4".gz "$DEPLOY_DIR2/"
+ fi
fi
-mv "$IMG_FILE" "$DEPLOY_DIR2/"
-
-# cp -a "$IMG_FILE_ROOT_EXT4" "${DEPLOY_DIR2}/sdcard/sys_arm64_000/rootfs.img"
-cp -a "$IMG_FILE_ROOT_SQFS_LZO" "${DEPLOY_DIR2}/sdcard/sys_arm64_000/rootfs.img"
+mv "$IMG_FILE" "$DEPLOY_DIR2/"
-mv "$IMG_FILE_ROOT_EXT4" "$DEPLOY_DIR2/"
-mv "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/"
-mv "$IMG_FILE_ROOT_SQFS_LZO" "$DEPLOY_DIR2/"
-mv "$IMG_FILE_ROOT_SQFS_NONE" "$DEPLOY_DIR2/"
-
-#mv "$IMG_FILE_BOOT" "$DEPLOY_DIR2/"
-#mv "$IMG_FILE_DATA" "$DEPLOY_DIR2/"
+if [ "${ROOTFS_RO}" = "1" ] ; then
+ # cp -a "$IMG_FILE_ROOT_EXT4" "${DEPLOY_DIR2}/sdcard-${STAGE}/sys_arm64_000/rootfs.img"
+ cp -a "$IMG_FILE_ROOT_SQFS_LZO" "${DEPLOY_DIR2}/sdcard-${STAGE}/sys_arm64_000/rootfs.img"
+ mv "$IMG_FILE_ROOT_EXT4" "$DEPLOY_DIR2/"
+ mv "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/"
+ mv "$IMG_FILE_ROOT_SQFS_LZO" "$DEPLOY_DIR2/"
+ mv "$IMG_FILE_ROOT_SQFS_NONE" "$DEPLOY_DIR2/"
+fi