Compare commits

...
Sign in to create a new pull request.

1 commit

3 changed files with 11 additions and 50 deletions

View file

@ -37,7 +37,7 @@ if [ "$init" = 'systemd' ]; then
else else
case "$os" in case "$os" in
debian|openwrt|devuan) openwrt|devuan)
state="absent" state="absent"
for file in "/etc/rc$runlevel.d/S"??"$name" for file in "/etc/rc$runlevel.d/S"??"$name"
do do
@ -48,33 +48,12 @@ else
fi fi
done done
;; ;;
ubuntu)
state="absent"
for file in "/etc/rc$runlevel.d/S"??"$name"
do
if [ -f "$file" ]
then
state="present"
break
fi
done
[ -f "/etc/init/${name}.conf" ] && state="present" owl)
;;
amazon|scientific|centos|fedora|owl|redhat)
state=$(chkconfig --level "$runlevel" "$name" || echo absent) state=$(chkconfig --level "$runlevel" "$name" || echo absent)
[ "$state" ] || state="present" [ "$state" ] || state="present"
;; ;;
suse)
# check for target if set, usable for boot. services in runlevel B
if [ "$target_runlevel" != 'default' ]; then
runlevel="$target_runlevel"
fi
# suses chkconfig has the same name, but works different ...
state=$(chkconfig --check "$name" "$runlevel" || echo absent)
[ "$state" ] || state="present"
;;
gentoo|alpine) gentoo|alpine)
state="absent" state="absent"
for d in /etc/runlevels/*; do for d in /etc/runlevels/*; do
@ -84,10 +63,12 @@ else
fi fi
done done
;; ;;
freebsd) freebsd)
state="absent" state="absent"
service -e | grep "/$name$" && state="present" service -e | grep "/$name$" && state="present"
;; ;;
openbsd) openbsd)
state='absent' state='absent'
# OpenBSD 5.7 and higher # OpenBSD 5.7 and higher

View file

@ -36,24 +36,10 @@ case "$state_should" in
present) present)
if [ "$init" = 'systemd' ]; then if [ "$init" = 'systemd' ]; then
# this handles ALL linux distros with systemd # this handles ALL linux distros with systemd
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions # e.g. debian, fedora, archlinux, gentoo in some cases, new RHEL and SLES versions
echo "systemctl -q enable '$name'" echo "systemctl -q enable '$name'"
else else
case "$os" in case "$os" in
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
;;
devuan) devuan)
echo "update-rc.d '$name' defaults >/dev/null" echo "update-rc.d '$name' defaults >/dev/null"
;; ;;
@ -62,7 +48,7 @@ case "$state_should" in
echo "rc-update add '$name' '$target_runlevel'" echo "rc-update add '$name' '$target_runlevel'"
;; ;;
amazon|scientific|centos|fedora|owl|redhat|suse) owl)
echo "chkconfig '$name' on" echo "chkconfig '$name' on"
;; ;;
@ -73,10 +59,6 @@ case "$state_should" in
echo "'/etc/init.d/$name' enable || [ -f /etc/rc.d/S??'$name' ]" echo "'/etc/init.d/$name' enable || [ -f /etc/rc.d/S??'$name' ]"
;; ;;
ubuntu)
echo "update-rc.d '$name' defaults >/dev/null"
;;
freebsd) freebsd)
: # handled in manifest : # handled in manifest
;; ;;
@ -102,7 +84,7 @@ case "$state_should" in
else else
case "$os" in case "$os" in
debian|ubuntu|devuan) devuan)
echo "update-rc.d -f '$name' remove" echo "update-rc.d -f '$name' remove"
;; ;;
@ -110,7 +92,7 @@ case "$state_should" in
echo "rc-update del '$name' '$target_runlevel'" echo "rc-update del '$name' '$target_runlevel'"
;; ;;
centos|fedora|owl|redhat|suse) owl)
echo "chkconfig '$name' off" echo "chkconfig '$name' off"
;; ;;

View file

@ -11,10 +11,6 @@ DESCRIPTION
This cdist type allows you to enable or disable stuff to be started This cdist type allows you to enable or disable stuff to be started
at boot of your operating system. at boot of your operating system.
Warning: This type has not been tested intensively and is not fully
supported.
REQUIRED PARAMETERS REQUIRED PARAMETERS
------------------- -------------------
None. None.
@ -24,6 +20,7 @@ OPTIONAL PARAMETERS
------------------- -------------------
state state
Either "present" or "absent", defaults to "present" Either "present" or "absent", defaults to "present"
target_runlevel target_runlevel
Runlevel which should be modified, defaults to "default" (only used on gentoo systems). Runlevel which should be modified, defaults to "default" (only used on gentoo systems).
@ -51,6 +48,7 @@ SEE ALSO
AUTHORS AUTHORS
------- -------
Nico Schottelius <nico-cdist--@--schottelius.org> Nico Schottelius <nico-cdist--@--schottelius.org>
Timothée Floure <work--@--tfloure.ch>
COPYING COPYING