forked from ungleich-public/cdist
Merge remote-tracking branch 'origin/master' into feature_install_and_preos
Signed-off-by: Nico Schottelius <nico@wurzel.schottelius.org>
This commit is contained in:
commit
ac866107fa
7 changed files with 88 additions and 11 deletions
|
@ -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"
|
||||
|
|
|
@ -195,7 +195,7 @@ case "$os" in
|
|||
init_sysvinit debian
|
||||
;;
|
||||
8)
|
||||
init_sysvinit
|
||||
init_systemd
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Debian version $os_version" >&2
|
||||
|
|
23
cdist/conf/type/__firewalld_rule/manifest
Normal file
23
cdist/conf/type/__firewalld_rule/manifest
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# This type allows to configure the desired localtime timezone.
|
||||
|
||||
__package firewalld
|
|
@ -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
|
||||
|
|
21
cdist/conf/type/__user_groups/explorer/oldusermod
Normal file
21
cdist/conf/type/__user_groups/explorer/oldusermod
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
usermod --help | grep -q -- '-A group' && echo true || echo false
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue