Merge pull request #467 from yaazkal/tzdata

Use host's time zone by default for jails
This commit is contained in:
Christer Edwards
2021-12-17 18:28:12 -07:00
committed by GitHub
2 changed files with 11 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ bastille_sharedir="/usr/local/share/bastille" ## default
bastille_bootstrap_archives="base" ## default: "base"
## default timezone
bastille_tzdata="Etc/UTC" ## default: "Etc/UTC"
bastille_tzdata="" ## default: empty to use host's time zone
## default jail resolv.conf
bastille_resolv_conf="/etc/resolv.conf" ## default: "/etc/resolv.conf"

View File

@@ -440,8 +440,16 @@ create_jail() {
ln -s usr/home home
fi
## TZ: configurable (default: Etc/UTC)
ln -s "/usr/share/zoneinfo/${bastille_tzdata}" etc/localtime
## TZ: configurable (default: empty to use host's time zone)
if [ -z "${bastille_tzdata}" ]; then
# Note that if host has no time zone, FreeBSD assumes UTC anyway
if [ -e /etc/localtime ]; then
# uses cp as a way to prevent issues with symlinks if the host happens to use that for tz configuration
cp /etc/localtime etc/localtime
fi
else
ln -s "/usr/share/zoneinfo/${bastille_tzdata}" etc/localtime
fi
# Post-creation jail misc configuration
# Create a dummy fstab file