@@ -20,7 +20,10 @@ ROOTFS_TAR="$CONTAINER_WORK_ROOT/rootfs.tar"
2020STAGING_DIR=" $CONTAINER_WORK_ROOT /rootfs"
2121USERLAND_BUILD=" $CONTAINER_WORK_ROOT /userland"
2222ROOT_PARTITION_IMAGE=" $CONTAINER_WORK_ROOT /rootfs.img"
23+ REFERENCE_TIMESTAMP=" $CONTAINER_WORK_ROOT /rootfs.timestamp"
2324export LIBGUESTFS_BACKEND=direct
25+ export LC_ALL=C
26+ export TZ=UTC
2427
2528cleanup () {
2629 rm -rf " $CONTAINER_WORK_ROOT "
@@ -68,6 +71,7 @@ chmod 755 "$STAGING_DIR/bin/sh" "$STAGING_DIR/bin/ls"
6871
6972truncate -s 62447616 " $DISK_IMAGE "
7073sfdisk " $DISK_IMAGE " < " $ROOTFS_DIR /layout.sfdisk" >> " $BUILD_LOG " 2>&1
74+ printf ' \0\0\0\0' | dd of=" $DISK_IMAGE " bs=1 seek=440 conv=notrunc >> " $BUILD_LOG " 2>&1
7175ROOT_PARTITION_SECTORS=$( awk -F' [=, ]+' ' /size=/{for (i = 1; i <= NF; i++) if ($i == "size") {print $(i + 1); exit}}' " $ROOTFS_DIR /layout.sfdisk" )
7276[ -n " $ROOT_PARTITION_SECTORS " ]
7377truncate -s " $(( ROOT_PARTITION_SECTORS * 512 )) " " $ROOT_PARTITION_IMAGE "
@@ -81,7 +85,10 @@ while IFS=' ' read -r kind mode major minor relative_path; do
8185 chmod " $mode " " $STAGING_DIR /$relative_path "
8286done < " $DEVICES_FILE "
8387
84- tar -C " $STAGING_DIR " -cpf " $ROOTFS_TAR " . >> " $BUILD_LOG " 2>&1
88+ touch -t 199301010000.00 " $REFERENCE_TIMESTAMP "
89+ find " $STAGING_DIR " -exec touch -h -r " $REFERENCE_TIMESTAMP " {} +
90+ tar --sort=name --mtime=" 1993-01-01 00:00:00Z" --owner=0 --group=0 --numeric-owner \
91+ -C " $STAGING_DIR " -cpf " $ROOTFS_TAR " . >> " $BUILD_LOG " 2>&1
8592
8693guestfish --format=raw -a " $ROOT_PARTITION_IMAGE " >> " $BUILD_LOG " 2>&1 << EOF
8794run
0 commit comments