feat(script): Write snapshot time in a user-configurable time zone (#1)
This commit is contained in:
parent
d9b1ae5905
commit
b8b3ad550d
@ -42,6 +42,13 @@ snap_name_prefix='pacman'
|
||||
# We do "$(date +<whatever>)" to put a timestamp into snapshot names.
|
||||
# Defaults to "$(date +'%F-%H%M')" which returns '2023-03-07-0050'.
|
||||
snap_date_format='%F-%H%M'
|
||||
# The tzdata-formatted timezone name used to add timestamps to snapshot
|
||||
# names. Check for example 'timedatectl list-timezones' to get a list of
|
||||
# valid names on your system. Format looks like 'America/Fortaleza',
|
||||
# 'Asia/Magadan' or 'Australia/Sydney'. Defaults to 'Etc/UTC'. Can also be
|
||||
# the empty string (as in snap_timezone='') in which case we'll use your
|
||||
# system's timezone setting.
|
||||
snap_timezone='Etc/UTC'
|
||||
|
||||
# Which strings do we want to diffferentiate pacman operations Install,
|
||||
# Remove, Upgrade
|
||||
|
@ -25,6 +25,7 @@ snap_only_local_datasets="${snap_only_local_datasets:-true}"
|
||||
snap_field_separator="${snap_field_separator:-_}"
|
||||
snap_name_prefix="${snap_name_prefix:-pacman}"
|
||||
snap_date_format="${snap_date_format:-%F-%H%M}"
|
||||
snap_timezone="${snap_timezone:-Etc/UTC}"
|
||||
snap_op_installation_suffix="${snap_op_installation_suffix:-inst}"
|
||||
snap_op_remove_suffix="${snap_op_remove_suffix:-rmvl}"
|
||||
snap_op_upgrade_suffix="${snap_op_upgrade_suffix:-upgr}"
|
||||
@ -309,7 +310,7 @@ function main () {
|
||||
write_pkg_list_oneline
|
||||
|
||||
local date_string max_dataset_name_length
|
||||
date_string="$(date +"${snap_date_format}")"
|
||||
date_string="$($([[ "${snap_timezone}" ]] && printf -- 'export TZ='"${snap_timezone}"); date +"${snap_date_format}")"
|
||||
find_max_dataset_name_length
|
||||
|
||||
local trimmed_pkg_list_oneline
|
||||
|
Loading…
x
Reference in New Issue
Block a user