initial template for __locale

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-10-14 21:27:07 +09:00
parent 9ded11daf0
commit e0b009308a
8 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,3 @@
de_CH.UTF-8 UTF-8
de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8

View File

@ -0,0 +1,37 @@
cat << eof
archive="/usr/lib/locale/locale-archive"
regen=no
if [ -f "$archive" ]; then
config_time=\$(stat --format "%Z" /etc/locale.gen)
archive_time=\$(stat --format "%Z" \"\$archive\")
if [ "$config_time" -gt "$archive_time" ]; then
regen=yes
fi
else
regen=yes
fi
if [ "\$regen" = yes ]; then
locale-gen
fi
eof
## probably not needed, it seems to be /usr/lib/locale/locale-archive
## everwhere!
# tmp=\$(mktemp /tmp/cdist.XXXXXXXX)
# find /usr/lib/locale -mindepth 1 > \$tmp
# while read archive; do
# archive_time=\$(stat --format "%Z" "\$archive\")
#
# if [ "\$config_time" -gt "\$archive_time" ]; then
# regen=yes
# break
# fi
# done < "$\tmp"

View File

@ -0,0 +1,50 @@
cdist-type__locale(7)
=====================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__locale - Configure locales
DESCRIPTION
-----------
This cdist type allows you to setup the locales.
REQUIRED MULTIPLE PARAMETERS
----------------------------
name::
Specify the locale to be present
OPTIONAL PARAMETERS
-------------------
state::
'present' or 'absent'
EXAMPLES
--------
--------------------------------------------------------------------------------
# Configure locales en_US and de_CH, both as UTF8
__locale --name "en_US.UTF-8 UTF-8" \
--name "de_CH.UTF-8 UTF-8" \
de_DE.UTF-8 UTF-8
--------------------------------------------------------------------------------
SEE ALSO
--------
- locale(1)
- cdist-type(7)
COPYING
-------
Copyright \(C) 2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -0,0 +1,8 @@
locales=$(cat "$__object/parameter/name")
state=$(cat "$__object/parameter/state")
__package locales --state $state
__file /etc/locale.gen \
--mode 0644 \
--source "$__object/parameter/name"

View File

@ -0,0 +1 @@
present

View File

@ -0,0 +1 @@
state

View File

@ -0,0 +1 @@
name

View File