summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-03 19:19:22 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-03 22:19:43 +0100
commit6cf3321d8471046bbbe203fb3f18d6507c402024 (patch)
treea1db23ca5b10a69f55d86258cf061f60e942e33e
parent23f02ec7eeeac790c247ba084b8755c3b718ff01 (diff)
downloadvyos-live-build-6cf3321d8471046bbbe203fb3f18d6507c402024.tar.gz
vyos-live-build-6cf3321d8471046bbbe203fb3f18d6507c402024.zip
config: provide UTC timestamp control
`DATE_UTC_OPTION` is set in `Prepare_config()` for use by scripts, even though only a few scripts will actually use it, since it allows those scripts to be cleaner. we may want to possibly extend this as a `DATE_OPTIONS` variable perhaps as part of enabling proper reproduciblity. Gbp-Dch: Short
-rwxr-xr-xfunctions/configuration.sh12
-rw-r--r--manpages/en/lb_config.14
-rwxr-xr-xscripts/build/config11
3 files changed, 26 insertions, 1 deletions
diff --git a/functions/configuration.sh b/functions/configuration.sh
index 0793c0dc8..5bce6df5e 100755
--- a/functions/configuration.sh
+++ b/functions/configuration.sh
@@ -42,6 +42,14 @@ Prepare_config ()
LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION}}"
LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_CHROOT}}"
+ LB_UTC_TIME="${LB_UTC_TIME:-false}"
+ # Set UTC option for use with `date` where applicable
+ if [ "${LB_UTC_TIME}" = "true" ]; then
+ DATE_UTC_OPTION="--utc"
+ else
+ DATE_UTC_OPTION=""
+ fi
+
LB_IMAGE_NAME="${LB_IMAGE_NAME:-live-image}"
LB_IMAGE_TYPE="${LB_IMAGE_TYPE:-iso-hybrid}"
#for backwards compatibility with hooks
@@ -533,6 +541,10 @@ Validate_config_permitted_values ()
Echo_error "Value for LB_UPDATES (--updates) can only be 'true' or 'false'!"
exit 1
fi
+ if [ "${LB_UTC_TIME}" != "true" ] && [ "${LB_UTC_TIME}" != "false" ]; then
+ Echo_error "Value for LB_UTC_TIME (--utc-time) can only be 'true' or 'false'!"
+ exit 1
+ fi
if [ "${LB_WIN32_LOADER}" != "true" ] && [ "${LB_WIN32_LOADER}" != "false" ]; then
Echo_error "Value for LB_WIN32_LOADER (--win32-loader) can only be 'true' or 'false'!"
exit 1
diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index e73e55abe..932a8e6ef 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -212,6 +212,8 @@
.br
[\fB\-\-updates\fR true|false]
.br
+ [\fB\-\-utc\-time\fR true|false]
+.br
[\fB\-\-validate\fR]
.br
[\fB\-\-verbose\fR]
@@ -434,6 +436,8 @@ defines if the resulting system image should be a live system or a normal, non-l
enables or disables Secure Boot support when using grub-efi, by installing signed shim and grub-efi packages. By default, this is set to auto, which means if the packages are available they will be installed, but if not only a warning will be printed and the normal non-signed grub-efi will be used.
.IP "\fB\-\-updates\fR true|false" 4
defines if debian updates package archives should be included in the image or not.
+.IP "\fB\-\-utc\-time\fR true|false" 4
+defines if timestamps should be UTC.
.IP "\fB\-\-validate\fR" 4
requests that the config be validated only, not changed, thus after the validation check the script ends rather than writing an updated config. Please note that at the time of writing, many options do not have corresponding validation checks.
.IP "\fB\-\-verbose\fR" 4
diff --git a/scripts/build/config b/scripts/build/config
index 3c62d2212..f8fd5ff89 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -119,6 +119,7 @@ USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\
\t [--system live|normal]\n\
\t [--uefi-secure-boot auto|enable|disable]\n\
\t [--updates true|false]\n\
+\t [--utc-time true|false]\n\
\t [--validate]\n\
\t [--verbose]\n\
\t [--win32-loader true|false]\n\
@@ -166,7 +167,7 @@ Local_arguments ()
quiet,
security:,source:,source-images:,swap-file-path:,swap-file-size:,system:,
tasksel:,
- uefi-secure-boot:,updates:,usage,
+ uefi-secure-boot:,updates:,utc-time:,usage,
validate,verbose,version,
win32-loader:,
zsync:"
@@ -792,6 +793,11 @@ Local_arguments ()
shift 2
;;
+ --utc-time)
+ LB_UTC_TIME="${2}"
+ shift 2
+ ;;
+
--win32-loader)
LB_WIN32_LOADER="${2}"
shift 2
@@ -1012,6 +1018,9 @@ DEBOOTSTRAP_SCRIPT="${DEBOOTSTRAP_SCRIPT}"
# Set options to use with gzip
GZIP_OPTIONS="${GZIP_OPTIONS}"
+# Enable UTC timestamps
+LB_UTC_TIME="${LB_UTC_TIME}"
+
# live-build options
# Enable breakpoints