Use faketime or datefudge if the former is not installed
This commit is contained in:
parent
6f5522bdcb
commit
76ef64b5be
10
Makefile
10
Makefile
|
@ -27,7 +27,7 @@ define date_command
|
||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
commit_timestamp = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y%m%d%H%m.%S'})"
|
commit_timestamp = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y%m%d%H%m.%S'})"
|
||||||
commit_faketime = "$$(${call date_command,"${COMMIT_TIMESTAMP_ISO_8601}",'+%Y-%m-%d %H:%m:%S'})"
|
commit_timestamp_iso_8601 = ${COMMIT_TIMESTAMP_ISO_8601}
|
||||||
|
|
||||||
offset_names = bytes_os_size \
|
offset_names = bytes_os_size \
|
||||||
bytes_mbr_start \
|
bytes_mbr_start \
|
||||||
|
@ -222,7 +222,7 @@ ${bld}/os.iso: ${bld}/iso_files/os.zip ${bld}/iso_files/boot/iso_boot.sys ./util
|
||||||
! test -d ${bld}/iso_files.tmp
|
! test -d ${bld}/iso_files.tmp
|
||||||
cp -a ${cp_T_option} -- ${bld}/iso_files ${bld}/iso_files.tmp
|
cp -a ${cp_T_option} -- ${bld}/iso_files ${bld}/iso_files.tmp
|
||||||
find ${bld}/iso_files.tmp -depth -exec touch -t ${commit_timestamp} '{}' ';'
|
find ${bld}/iso_files.tmp -depth -exec touch -t ${commit_timestamp} '{}' ';'
|
||||||
UTILS="$$PWD/utils" (cd ./${bld}/iso_files.tmp/ && faketime -f ${commit_faketime} $$UTILS/mkisofs \
|
UTILS="$$PWD/utils" ./utils/faketime.sh ${commit_timestamp_iso_8601} sh -c '(cd ./${bld}/iso_files.tmp/ && "$$UTILS/mkisofs" \
|
||||||
--input-charset utf-8 \
|
--input-charset utf-8 \
|
||||||
-rock \
|
-rock \
|
||||||
-joliet \
|
-joliet \
|
||||||
|
@ -232,7 +232,7 @@ ${bld}/os.iso: ${bld}/iso_files/os.zip ${bld}/iso_files/boot/iso_boot.sys ./util
|
||||||
-boot-load-size 4 \
|
-boot-load-size 4 \
|
||||||
-pad \
|
-pad \
|
||||||
-output ../os.iso \
|
-output ../os.iso \
|
||||||
.)
|
.)'
|
||||||
rm -- ${bld}/iso_files.tmp/os.zip \
|
rm -- ${bld}/iso_files.tmp/os.zip \
|
||||||
${bld}/iso_files.tmp/boot/iso_boot.sys
|
${bld}/iso_files.tmp/boot/iso_boot.sys
|
||||||
rmdir ${bld}/iso_files.tmp/boot/
|
rmdir ${bld}/iso_files.tmp/boot/
|
||||||
|
@ -301,12 +301,12 @@ os_fat12_partition = "$@@@${bytes_fat12_start}"
|
||||||
${bld}/os.fat12: ${bld}/os.zip ${dep_bytes_fat12_size} ${dep_bytes_fat12_start} ${dep_sectors_os_size} \
|
${bld}/os.fat12: ${bld}/os.zip ${dep_bytes_fat12_size} ${dep_bytes_fat12_start} ${dep_sectors_os_size} \
|
||||||
./utils/mformat ./utils/mcopy ${bld}/check_makefile
|
./utils/mformat ./utils/mcopy ${bld}/check_makefile
|
||||||
set -x; dd if=/dev/zero bs=${sector_size} count=${sectors_os_size} of=$@
|
set -x; dd if=/dev/zero bs=${sector_size} count=${sectors_os_size} of=$@
|
||||||
faketime -f ${commit_faketime} ./utils/mformat -v "Example OS" \
|
./utils/faketime.sh ${commit_timestamp_iso_8601} ./utils/mformat -v "Example OS" \
|
||||||
-T ${sectors_fat12_size} \
|
-T ${sectors_fat12_size} \
|
||||||
-h ${os_floppy_chs_h} \
|
-h ${os_floppy_chs_h} \
|
||||||
-s ${os_floppy_chs_s} \
|
-s ${os_floppy_chs_s} \
|
||||||
-i ${os_fat12_partition}
|
-i ${os_fat12_partition}
|
||||||
faketime -f ${commit_faketime} ./utils/mcopy -i ${os_fat12_partition} $< "::os.zip"
|
./utils/faketime.sh ${commit_timestamp_iso_8601} ./utils/mcopy -i ${os_fat12_partition} $< "::os.zip"
|
||||||
|
|
||||||
${bld}/iso_files/os.zip: ${bld}/os.zip ${bld}/check_makefile
|
${bld}/iso_files/os.zip: ${bld}/os.zip ${bld}/check_makefile
|
||||||
# TODO: make it so that the various file formats are mutual quines:
|
# TODO: make it so that the various file formats are mutual quines:
|
||||||
|
|
24
utils/faketime.sh
Executable file
24
utils/faketime.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euET -o pipefail
|
||||||
|
|
||||||
|
timestamp_iso_8601="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
date_command() {
|
||||||
|
# TODO: substring or case … in Darwin*)
|
||||||
|
if test "$(uname -s)" = Darwin; then
|
||||||
|
date -j -f '%Y-%m-%dT%H:%M:%S' "$(echo "${1}" | cut -c 1-19)" "${2}";
|
||||||
|
else
|
||||||
|
date -d "${1}" "${2}";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if which faketime >/dev/null; then
|
||||||
|
( set -x; faketime -f "$(date_command "${timestamp_iso_8601}" '+%Y-%m-%d %H:%m:%S')" "$@"; )
|
||||||
|
elif which datefudge >/dev/null; then
|
||||||
|
( set -x; datefudge --static "${timestamp_iso_8601}" "$@"; )
|
||||||
|
else
|
||||||
|
echo "ERROR: command faketime or datefudge not found. Please install either command."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user