forked from ungleich-public/cdist
update explorer and gencode and parameter
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
0ccf000713
commit
fe0fae6902
5 changed files with 29 additions and 49 deletions
|
@ -22,6 +22,7 @@
|
|||
#
|
||||
|
||||
os=$("$__explorer/os")
|
||||
runlevel=$("$__explorer/runlevel")
|
||||
|
||||
case "$os" in
|
||||
debian|ubuntu)
|
||||
|
@ -33,7 +34,8 @@ case "$os" in
|
|||
;;
|
||||
|
||||
centos|fedora|owl|redhat)
|
||||
echo chkconfig \"$name\" on
|
||||
state=$(chkconfig --level "$runlevel" \"$name\" || echo absent)
|
||||
[ "$state" ] || state="present"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -42,3 +44,4 @@ case "$os" in
|
|||
;;
|
||||
esac
|
||||
|
||||
echo $state
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
#
|
||||
# __file is a very basic type, which will probably be reused quite often
|
||||
#
|
||||
|
||||
destination="/$__object_id"
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
|
||||
if [ "$state_should" = "present" ]; then
|
||||
if [ -f "$__object/parameter/source" ]; then
|
||||
source="$(cat "$__object/parameter/source")"
|
||||
|
||||
if [ -f "$source" ]; then
|
||||
local_cksum="$(cksum < "$source")"
|
||||
remote_cksum="$(cat "$__object/explorer/cksum")"
|
||||
|
||||
if [ "$local_cksum" != "$remote_cksum" ]; then
|
||||
echo "$__remote_copy" "$source" "${__target_host}:${destination}"
|
||||
fi
|
||||
else
|
||||
echo "Source \"$source\" does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -25,6 +25,11 @@ else
|
|||
state_should="present"
|
||||
fi
|
||||
|
||||
state_is=$(cat "$__object/explorer/state")
|
||||
|
||||
# Nothing todo, go away
|
||||
[ "$state_should" = "$state_is" ] && exit 0
|
||||
|
||||
os=$(cat "$__global/explorer/os")
|
||||
name="$__object_id"
|
||||
|
||||
|
@ -43,7 +48,7 @@ case "$state_should" in
|
|||
;;
|
||||
|
||||
centos|fedora|owl|redhat)
|
||||
echo echo chkconfig \"$name\" on
|
||||
echo chkconfig \"$name\" on
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -54,7 +59,25 @@ case "$state_should" in
|
|||
;;
|
||||
|
||||
absent)
|
||||
case "$os" in
|
||||
debian|ubuntu)
|
||||
echo update-rc.d -f \"$name\" remove
|
||||
;;
|
||||
|
||||
gentoo)
|
||||
echo rc-update del \"$name\"
|
||||
;;
|
||||
|
||||
centos|fedora|owl|redhat)
|
||||
echo chkconfig \"$name\" off
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported os: $os" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
;;
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ state::
|
|||
|
||||
runlevel::
|
||||
Specify runlevel(s) to affect. Defaults to default or current runlevel.
|
||||
NOT YET SUPPORTED, ALWAYS USING CURRENT RUNLEVEL.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
state
|
||||
group
|
||||
mode
|
||||
owner
|
||||
source
|
||||
|
|
Loading…
Reference in a new issue