Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions type/__timezone/explorer/timezone_is

This file was deleted.

61 changes: 61 additions & 0 deletions type/__timezone/explorer/zoneinfo_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh -e
#
# 2020 Dennis Camera (dennis.camera at riiengineering.ch)
#
# This file is part of skonfig-base.
#
# skonfig-base is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# skonfig-base is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with skonfig-base. If not, see <http://www.gnu.org/licenses/>.
#
# Determine and print the path of the --tz zoneinfo file.
# If the zone is invalid, the explorer produces empty output.
#

TZ=$(cat "${__object:?}/parameter/tz")

if test -s "${__object:?}/parameter/tzdir"
then
TZDIR=$(cat "${__object:?}/parameter/tzdir")

test -d "${TZDIR}" || {
printf 'Invalid --tzdir: no such directory: %s\n' "${TZDIR}" >&2
exit 1
}
else
case $(uname -s)
in
(Darwin)
TZDIR=/var/db/timezone/zoneinfo
;;
(SunOS)
TZDIR=/usr/share/lib/zoneinfo
;;
(*)
# According to glibc's tzfile(5) there are two typical directories:
if test -d /usr/share/zoneinfo
then
# Linux, FreeBSD, OpenBSD, NetBSD. And others?
TZDIR=/usr/share/zoneinfo
elif test -d /usr/lib/zoneinfo
then
# Old libc4, libc5 apparently.
TZDIR=/usr/lib/zoneinfo
fi
;;
esac
fi

if test -n "${TZDIR-}" && test -e "${TZDIR}/${TZ}"
then
echo "${TZDIR}/${TZ}"
fi
36 changes: 0 additions & 36 deletions type/__timezone/gencode-remote

This file was deleted.

29 changes: 25 additions & 4 deletions type/__timezone/man.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,35 @@ cdist-type__timezone(7)

NAME
----
cdist-type__timezone - Allows one to configure the desired localtime timezone.
cdist-type__timezone - Configure the system timezone.


DESCRIPTION
-----------
This type creates a symlink (/etc/localtime) to the selected timezone
(which should be available in /usr/share/zoneinfo).
This type creates a symlink (``/etc/localtime``) to the selected
timezone (which should be available in ``--tzdir`` which is usually
``/usr/share/zoneinfo``).

On some operating systems, other system-specific files are modified as well.

If necessary, the zoneinfo database (``tzdata``) will be installed on the target.


REQUIRED PARAMETERS
-------------------
tz
The name of the timezone to set.

It should map to a file present in ``--tzdir``.


OPTIONAL PARAMETERS
-------------------
tzdir
The directory containing the timezone data files on the target.

Default: detected based on OS, usually ``/usr/share/zoneinfo``.


EXAMPLES
--------
Expand All @@ -29,6 +44,12 @@ EXAMPLES
# Set up US/Central as our timezone.
__timezone --tz US/Central

# Some operating systems (e.g. Debian, RedHat, SuSE) have a separate
# directory for POSIX timezones (time values interpreted as seconds since
# the epoch, not counting leap seconds).
# It can be used by manually specifying the TZDIR.
__timezone --tz Europe/Vaduz --tzdir /usr/share/zoneinfo/posix


AUTHORS
-------
Expand All @@ -40,7 +61,7 @@ AUTHORS

COPYING
-------
Copyright \(C) 2012-2020 the `AUTHORS`_.
Copyright \(C) 2012-2025 the `AUTHORS`_.
You can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Loading