From 224ee96f58dfdcc51b99f22124f2a14b8151ae8b Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Mon, 30 Apr 2012 08:31:31 +0000 Subject: Trust systemd install rules if avaialble, only then fall back to manual linking --- add-service | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/add-service b/add-service index cee3b14..0c0a887 100755 --- a/add-service +++ b/add-service @@ -230,14 +230,15 @@ else if [ -n "$enable_targets" ]; then for unit in $full_path_units; do bn_unit="$(basename $unit)" - if [[ "$bn_unit" =~ "@.service" ]]; then - # We cannot simply link template units + if grep -qE "^(WantedBy|Alias)=" $unit; then if [ x$init = xsystemd -a x$reloaded = xno ]; then /bin/systemctl --system daemon-reload reloaded=yes fi - echo 1>&2 "Migrating sysvinit service '$srv' to systemd native template unit '$bn_unit'" + echo 1>&2 "Migrating sysvinit service '$srv' to systemd native unit '$bn_unit' via systemd install rules." /bin/systemctl enable $bn_unit + elif [[ "$bn_unit" =~ "@.service" ]]; then + echo 1>&2 "Migrating sysvinit service '$srv' to systemd native template unit '$bn_unit': Failed - no install rules" else for enable_target in $enable_targets; do wantsdir=$USERUNITDIR/${enable_target}.wants -- cgit v1.2.1