diff --git a/cdist/conf/type/__block/manifest b/cdist/conf/type/__block/manifest index 1fc9ec79..bf96181c 100755 --- a/cdist/conf/type/__block/manifest +++ b/cdist/conf/type/__block/manifest @@ -31,6 +31,6 @@ echo "$prefix" > "$block" if [ "$text" = "-" ]; then cat "$__object/stdin" >> "$block" else - cat "$text" >> "$block" + echo "$text" >> "$block" fi echo "$suffix" >> "$block" diff --git a/cdist/conf/type/__consul_agent/manifest b/cdist/conf/type/__consul_agent/manifest index 198b83d6..f8cace94 100755 --- a/cdist/conf/type/__consul_agent/manifest +++ b/cdist/conf/type/__consul_agent/manifest @@ -195,7 +195,7 @@ case "$os" in init_sysvinit debian ;; 8) - init_sysvinit + init_systemd ;; *) echo "Unsupported Debian version $os_version" >&2 diff --git a/cdist/conf/type/__firewalld_rule/manifest b/cdist/conf/type/__firewalld_rule/manifest new file mode 100644 index 00000000..5baf6da3 --- /dev/null +++ b/cdist/conf/type/__firewalld_rule/manifest @@ -0,0 +1,23 @@ +#!/bin/sh +# +# 2015 David Hürlimann (david at ungleich.ch) +# +# This file is part of cdist. +# +# cdist 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. +# +# cdist 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 cdist. If not, see . +# +# +# This type allows to configure the desired localtime timezone. + +__package firewalld diff --git a/cdist/conf/type/__start_on_boot/gencode-remote b/cdist/conf/type/__start_on_boot/gencode-remote index 61b2b9fe..611e59fe 100755 --- a/cdist/conf/type/__start_on_boot/gencode-remote +++ b/cdist/conf/type/__start_on_boot/gencode-remote @@ -28,6 +28,7 @@ target_runlevel="$(cat "$__object/parameter/target_runlevel")" [ "$state_should" = "$state_is" ] && exit 0 os=$(cat "$__global/explorer/os") +os_version=$(cat "$__global/explorer/os_version") name="$__object_id" case "$state_should" in @@ -36,8 +37,19 @@ case "$state_should" in archlinux) echo "systemctl enable \"$name\"" ;; - debian|ubuntu) - echo "update-rc.d \"$name\" defaults >/dev/null" + debian) + case "$os_version" in + [1-7]*) + echo "update-rc.d \"$name\" defaults >/dev/null" + ;; + 8*) + echo "systemctl enable \"$name\"" + ;; + *) + echo "Unsupported version $os_version of $os" >&2 + exit 1 + ;; + esac ;; gentoo) @@ -55,6 +67,10 @@ case "$state_should" in echo "/etc/init.d/\"$name\" enable || [ -f /etc/rc.d/S??\"$name\" ]" ;; + ubuntu) + echo "update-rc.d \"$name\" defaults >/dev/null" + ;; + *) echo "Unsupported os: $os" >&2 exit 1 diff --git a/cdist/conf/type/__user_groups/explorer/oldusermod b/cdist/conf/type/__user_groups/explorer/oldusermod new file mode 100644 index 00000000..6ef25b13 --- /dev/null +++ b/cdist/conf/type/__user_groups/explorer/oldusermod @@ -0,0 +1,21 @@ +#!/bin/sh +# +# 2015 Heule Daniel (hda at sfs.biz) +# +# This file is part of cdist. +# +# cdist 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. +# +# cdist 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 cdist. If not, see . +# + +usermod --help | grep -q -- '-A group' && echo true || echo false diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote index 9f11dd16..65404bfc 100755 --- a/cdist/conf/type/__user_groups/gencode-remote +++ b/cdist/conf/type/__user_groups/gencode-remote @@ -20,6 +20,15 @@ user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" state_should="$(cat "$__object/parameter/state")" +oldusermod="$(cat "$__object/explorer/oldusermod")" + +if [ "$oldusermod" = "true" ]; then + addparam="-A" + delparam="-R" +else + addparam="-a" + delparam="-d" +fi mkdir "$__object/files" # file has to be sorted for comparison with `comm` @@ -28,11 +37,11 @@ sort "$__object/parameter/group" > "$__object/files/group.sorted" case "$state_should" in present) changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")" - action="-a" + action="$addparam" ;; absent) changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")" - action="-d" + action="$delparam" ;; esac @@ -42,5 +51,9 @@ if [ -z "$changed_groups" ]; then fi for group in $changed_groups; do - echo "gpasswd $action \"$user\" \"$group\"" + if [ "$oldusermod" = "true" ]; then + echo "usermod $action \"$group\" \"$user\"" + else + echo "gpasswd $action \"$user\" \"$group\"" + fi done diff --git a/docs/changelog b/docs/changelog index 0090384e..0b010a17 100644 --- a/docs/changelog +++ b/docs/changelog @@ -2,17 +2,21 @@ Changelog --------- * Changes are always commented with their author in (braces) - * Exception: No braces means author == Nico Schottelius 4.0.0pre3: 2014-06-13 - * Update to include changes from cdist 3.1.5 + * Update to include changes from cdist 3.1.5 (Nico Schottelius) 4.0.0pre2: 2014-02-14 * Core: Remove archives from generated preos (Steven Armstrong) 4.0.0pre1: 2014-01-20 - * Core: Integrate initial install support - * Core: Integrate initial preos support + * Core: Integrate initial install support (Nico Schottelius) + * Core: Integrate initial preos support (Nico Schottelius) + +next: + * Type __block: Fix support for non stdin blocks (Dominique Roux) + * Type __consul_agent: Use systemd for Debian 8 (Nico Schottelius) + * Type __firewalld_rule: Ensure firewalld is present (David Hürlimann) 3.1.12: 2015-03-19 * Core: Support object ids '.cdist' (Nico Schottelius)