update explorer and gencode and parameter

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-01-18 16:07:33 +01:00
parent 0ccf000713
commit fe0fae6902
5 changed files with 29 additions and 49 deletions

View file

@ -22,6 +22,7 @@
# #
os=$("$__explorer/os") os=$("$__explorer/os")
runlevel=$("$__explorer/runlevel")
case "$os" in case "$os" in
debian|ubuntu) debian|ubuntu)
@ -33,7 +34,8 @@ case "$os" in
;; ;;
centos|fedora|owl|redhat) 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 esac
echo $state

View file

@ -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

View file

@ -25,6 +25,11 @@ else
state_should="present" state_should="present"
fi fi
state_is=$(cat "$__object/explorer/state")
# Nothing todo, go away
[ "$state_should" = "$state_is" ] && exit 0
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
name="$__object_id" name="$__object_id"
@ -43,7 +48,7 @@ case "$state_should" in
;; ;;
centos|fedora|owl|redhat) centos|fedora|owl|redhat)
echo echo chkconfig \"$name\" on echo chkconfig \"$name\" on
;; ;;
*) *)
@ -54,6 +59,24 @@ case "$state_should" in
;; ;;
absent) 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
;; ;;

View file

@ -25,6 +25,7 @@ state::
runlevel:: runlevel::
Specify runlevel(s) to affect. Defaults to default or current runlevel. Specify runlevel(s) to affect. Defaults to default or current runlevel.
NOT YET SUPPORTED, ALWAYS USING CURRENT RUNLEVEL.
EXAMPLES EXAMPLES

View file

@ -1,5 +1 @@
state state
group
mode
owner
source