diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 136c1e05..8db4b9d2 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -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 diff --git a/conf/type/__start_on_boot/gencode-local b/conf/type/__start_on_boot/gencode-local deleted file mode 100755 index d9839a19..00000000 --- a/conf/type/__start_on_boot/gencode-local +++ /dev/null @@ -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 . -# -# -# __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 diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 5133810d..aa854658 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -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 + ;; diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index eb9dbe7f..5614f16b 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -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 diff --git a/conf/type/__start_on_boot/parameter/optional b/conf/type/__start_on_boot/parameter/optional index c696d592..ff72b5c7 100644 --- a/conf/type/__start_on_boot/parameter/optional +++ b/conf/type/__start_on_boot/parameter/optional @@ -1,5 +1 @@ state -group -mode -owner -source