+update of __start_on_boot

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-01-18 15:54:32 +01:00
parent 6b6ae1bde2
commit 42e3c18d02
3 changed files with 39 additions and 37 deletions

View file

@ -21,7 +21,7 @@
# Check whether the given name will be started on boot or not # Check whether the given name will be started on boot or not
# #
os=$(cat "$__global/explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
debian|ubuntu) debian|ubuntu)

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Nico Schottelius (nico-cdist at schottelius.org) # 2012 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -18,49 +18,48 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # 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" if [ -f "$__object/parameter/state" ]; then
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
exists="$(cat "$__object/explorer/exists")" else
state_should="present"
fi
os=$(cat "$__global/explorer/os")
name="$__object_id"
# Support runlevels later
#runlevel=$(cat $__global/explorer/runlevel)
case "$state_should" in case "$state_should" in
present) present)
# No source? Create empty file case "$os" in
if [ ! -f "$__object/parameter/source" ]; then debian|ubuntu)
if [ "$exists" = "no" ]; then echo update-rc.d \"$name\" defaults
echo touch \"$destination\" ;;
fi
fi
# Mode settings gentoo)
if [ -f "$__object/parameter/mode" ]; then echo rc-update add \"$name\" default
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" ;;
fi
# Group centos|fedora|owl|redhat)
if [ -f "$__object/parameter/group" ]; then echo echo chkconfig \"$name\" on
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" ;;
fi
# Owner *)
if [ -f "$__object/parameter/owner" ]; then echo "Unsupported os: $os" >&2
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" exit 1
fi ;;
;; esac
;;
absent) absent)
if [ "$exists" = "yes" ]; then ;;
echo rm -f \"$destination\"
fi
;;
*)
echo "Unknown state: $state_should" >&2
exit 1
;;
*)
echo "Unknown state: $state_should" >&2
exit 1
;;
esac esac

View file

@ -23,6 +23,9 @@ OPTIONAL PARAMETERS
state:: state::
'present' or 'absent', defaults to 'present' 'present' or 'absent', defaults to 'present'
runlevel::
Specify runlevel(s) to affect. Defaults to default or current runlevel.
EXAMPLES EXAMPLES
-------- --------