From 00f524773e6d798b880425dac7940439b809eb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Fri, 5 Jan 2018 22:04:13 +0100 Subject: [PATCH] __daemontools fixes make __daemontools more robust and clean up the --install-init-script confusion --- cdist/conf/type/__daemontools/manifest | 56 +++++++++++++------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/cdist/conf/type/__daemontools/manifest b/cdist/conf/type/__daemontools/manifest index 75f26ca0..45ce3df6 100755 --- a/cdist/conf/type/__daemontools/manifest +++ b/cdist/conf/type/__daemontools/manifest @@ -4,34 +4,36 @@ pkg=$(cat "$__object/parameter/from-package") servicedir=$(cat "$__object/parameter/servicedir") __package $pkg -__directory $servicedir --mode 755 +__directory $servicedir --mode 700 -if [ -f "$__object/parameter/install-init-script" ]; then - os=$(cat "$__global/explorer/os") - init=$(cat "$__global/explorer/init") +os=$(cat "$__global/explorer/os") +init=$(cat "$__global/explorer/init") - case $init in - init) - case $os in - freebsd) - __config_file /etc/rc.conf.d/svscan --source - <<-EOT - svscan_enable="YES" - svscan_servicedir="$servicedir" - EOT - require="$require __package/$pkg __directory/$servicedir __config_file/etc/rc.conf.d/svscan" \ - __process svscan --start 'service svscan start' - ;; - *) +case $os in + freebsd) + # TODO change to __start_on_boot once it supports freebsd + __config_file /etc/rc.conf.d/svscan --source - <<-EOT + svscan_enable="YES" + svscan_servicedir="$servicedir" + EOT + require="$require __package/$pkg __directory/$servicedir __config_file/etc/rc.conf.d/svscan" \ + __process svscan --name ".*/svscan $servicedir" --start 'service svscan start' + ;; + *) + case $init in + init) + if [ -f "$__object/parameter/install-init-script" ]; then __config_file /etc/init.d/svscan --mode 755 --source "$__type/files/init.d-svscan" - require="$require __config_file/etc/init.d/svscan" __start_on_boot svscan - require="$require __package/$pkg __directory/$servicedir __start_on_boot/svscan" \ - __process svscan --start 'service svscan start' - ;; - esac + REQUIREEXTRA="__config_file/etc/init.d/svscan" + fi + require="$require $REQUIREEXTRA" __start_on_boot svscan + require="$require __package/$pkg __directory/$servicedir __start_on_boot/svscan" \ + __process svscan --name ".*/svscan $servicedir" --start 'service svscan start' ;; - *) - echo "Your init system ($init) is not supported by this type. Submit a patch at github.com/ungleich/cdist!" - exit 1 - ;; - esac -fi + *) + echo "Your init system ($init) is not supported by this type. Submit a patch at github.com/ungleich/cdist!" + exit 1 + ;; + esac + ;; +esac