diff --git a/cdist/conf/type/__locale/files/locale.gen b/cdist/conf/type/__locale/files/locale.gen new file mode 100644 index 00000000..cf8e8651 --- /dev/null +++ b/cdist/conf/type/__locale/files/locale.gen @@ -0,0 +1,3 @@ +de_CH.UTF-8 UTF-8 +de_DE.UTF-8 UTF-8 +en_US.UTF-8 UTF-8 diff --git a/cdist/conf/type/__locale/gencode-remote b/cdist/conf/type/__locale/gencode-remote new file mode 100644 index 00000000..aa03b46c --- /dev/null +++ b/cdist/conf/type/__locale/gencode-remote @@ -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" diff --git a/cdist/conf/type/__locale/man.text b/cdist/conf/type/__locale/man.text new file mode 100644 index 00000000..9ed4a6d1 --- /dev/null +++ b/cdist/conf/type/__locale/man.text @@ -0,0 +1,50 @@ +cdist-type__locale(7) +===================== +Nico Schottelius + + +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). diff --git a/cdist/conf/type/__locale/manifest b/cdist/conf/type/__locale/manifest new file mode 100644 index 00000000..dd3f0f55 --- /dev/null +++ b/cdist/conf/type/__locale/manifest @@ -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" diff --git a/cdist/conf/type/__locale/parameter/default/state b/cdist/conf/type/__locale/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__locale/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__locale/parameter/optional b/cdist/conf/type/__locale/parameter/optional new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/cdist/conf/type/__locale/parameter/optional @@ -0,0 +1 @@ +state diff --git a/cdist/conf/type/__locale/parameter/required_multiple b/cdist/conf/type/__locale/parameter/required_multiple new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/cdist/conf/type/__locale/parameter/required_multiple @@ -0,0 +1 @@ +name diff --git a/cdist/conf/type/__locale/singleton b/cdist/conf/type/__locale/singleton new file mode 100644 index 00000000..e69de29b