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
This commit is contained in:
Lyndon Brown 2020-05-03 19:19:22 +01:00
parent 23f02ec7ee
commit 6cf3321d84
3 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -211,6 +211,8 @@
[\fB\-\-uefi\-secure\-boot\fR auto|enable|disable]
.br
[\fB\-\-updates\fR true|false]
.br
[\fB\-\-utc\-time\fR true|false]
.br
[\fB\-\-validate\fR]
.br
@ -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

View File

@ -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