Compare commits

..

1 commit

6 changed files with 12 additions and 66 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

View file

@ -34,12 +34,3 @@ case "$os" in
echo "echo \"$timezone_should\" > /etc/timezone" echo "echo \"$timezone_should\" > /etc/timezone"
;; ;;
esac esac
case "$os" in
openwrt)
cat <<EOF
uci set system.@system[0].timezone="$timezone_should"
uci commit
EOF
;;
esac

View file

@ -53,10 +53,7 @@ case "$os" in
--file /etc/sysconfig/clock \ --file /etc/sysconfig/clock \
--delimiter '=' \ --delimiter '=' \
--value "\"$timezone\"" --value "\"$timezone\""
;; ;;
openwrt)
: # Uses gencode-remote
;;
*) *)
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
echo "Please contribute an implementation for it if you can." >&2 echo "Please contribute an implementation for it if you can." >&2

View file

@ -1,9 +1,6 @@
Changelog Changelog
--------- ---------
next:
* Type __timezone: Add support for OpenWRT (Nico Schottelius)
7.0.1: 7.0.1:
* Core: Remove double definition of scan parser (Nico Schottelius) * Core: Remove double definition of scan parser (Nico Schottelius)
* Type __apt_mark: Narrow down grep for hold packages (marcoduif) * Type __apt_mark: Narrow down grep for hold packages (marcoduif)