From ec935353d75a3bfde5f37862668ba18ab0d63181 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 15 Apr 2019 17:02:09 +0200 Subject: [PATCH] [__start_on_boot] Merge alpine and gentoo, update gentoo --- cdist/conf/type/__start_on_boot/explorer/state | 15 ++++++++------- cdist/conf/type/__start_on_boot/gencode-remote | 10 ++-------- docs/changelog | 1 + 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/cdist/conf/type/__start_on_boot/explorer/state b/cdist/conf/type/__start_on_boot/explorer/state index 37f41806..b7a6cf0f 100644 --- a/cdist/conf/type/__start_on_boot/explorer/state +++ b/cdist/conf/type/__start_on_boot/explorer/state @@ -75,9 +75,14 @@ else state=$(chkconfig --check "$name" "$runlevel" || echo absent) [ "$state" ] || state="present" ;; - gentoo) - state="present" - [ -f "/etc/runlevels/${target_runlevel}/${name}" ] || state="absent" + gentoo|alpine) + state="absent" + for d in /etc/runlevels/*; do + if [ -f "/etc/runlevels/${d}/${name}" ];then + state="present" + break + fi + done ;; freebsd) state="absent" @@ -88,10 +93,6 @@ else # OpenBSD 5.7 and higher rcctl ls on | grep "^${name}$" && state='present' ;; - alpine) - state="$(rc-update show | sed 's/ *//' | grep -q "^${name} |" && echo present)" - [ "$state" ] || state="absent" - ;; *) echo "Unsupported os: $os" >&2 diff --git a/cdist/conf/type/__start_on_boot/gencode-remote b/cdist/conf/type/__start_on_boot/gencode-remote index 56f0dbdb..c900933f 100755 --- a/cdist/conf/type/__start_on_boot/gencode-remote +++ b/cdist/conf/type/__start_on_boot/gencode-remote @@ -40,9 +40,6 @@ case "$state_should" in echo "systemctl -q enable '$name'" else case "$os" in - alpine) - echo "rc-update -q add '${name}'" - ;; debian) case "$os_version" in [1-7]*) @@ -61,7 +58,7 @@ case "$state_should" in echo "update-rc.d '$name' defaults >/dev/null" ;; - gentoo) + alpine|gentoo) echo "rc-update add '$name' '$target_runlevel'" ;; @@ -105,14 +102,11 @@ case "$state_should" in else case "$os" in - alpine) - echo "rc-update -q del '${name}'" - ;; debian|ubuntu|devuan) echo "update-rc.d -f '$name' remove" ;; - gentoo) + alpine|gentoo) echo "rc-update del '$name' '$target_runlevel'" ;; diff --git a/docs/changelog b/docs/changelog index da503525..ab239357 100644 --- a/docs/changelog +++ b/docs/changelog @@ -3,6 +3,7 @@ Changelog next: * Type __package: Add __package_apk support (Nico Schottelius) + * Type __start_on_boot: Add alpine support (Nico Schottelius) * New type: __package_apk (Nico Schottelius) 4.10.11: 2019-04-13