aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2012-07-28 00:54:42 (GMT)
committerTom Gundersen <teg@jklm.no>2012-07-28 00:54:42 (GMT)
commitf670511763a05ac5ef688d335187ac1ccabf0487 (patch)
treed89832dfb7d0022225d8887d3a5a78bf7ed3cab8
parentb0b1d8fb0f933b37e5878541e18034614eed47fb (diff)
downloadinitscripts-f670511763a05ac5ef688d335187ac1ccabf0487.tar.xz
arch-daemons: add some sanity checking
Don't create wrapper services, for things that are not exectuable files. Signed-off-by: Tom Gundersen <teg@jklm.no>
-rwxr-xr-xarch-daemons9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch-daemons b/arch-daemons
index 34f4597..ffe4289 100755
--- a/arch-daemons
+++ b/arch-daemons
@@ -13,10 +13,19 @@ dest=$3
# list of services that have to be started before the next one
deps=()
+# Check if $1 is a valid daemon name
+have_daemon() {
+ [[ -f /etc/rc.d/$1 && -x /etc/rc.d/$1 ]]
+}
+
# Make service file
create_unit() {
local deps= daemon=${1%.service}
+ if ! have_daemon $daemon; then
+ return
+ fi
+
(( $# > 1 )) && printf -v deps 'After=%s\n' "${*:2}"
printf \