summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/systemd.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/systemd.bbclass')
-rw-r--r--meta/classes-recipe/systemd.bbclass18
1 files changed, 12 insertions, 6 deletions
diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index 592f15a4b7..0bce015509 100644
--- a/meta/classes-recipe/systemd.bbclass
+++ b/meta/classes-recipe/systemd.bbclass
@@ -37,17 +37,19 @@ if systemctl >/dev/null 2>/dev/null; then
37 fi 37 fi
38 38
39 if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then 39 if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
40 for service in ${SYSTEMD_SERVICE_ESCAPED}; do 40 for service in ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}; do
41 systemctl ${OPTS} enable "$service" 41 systemctl ${OPTS} enable "$service"
42 done 42 done
43 fi 43 fi
44 44
45 if [ -z "$D" ]; then 45 if [ -z "$D" ]; then
46 systemctl daemon-reload 46 systemctl daemon-reload
47 systemctl preset ${SYSTEMD_SERVICE_ESCAPED} 47 [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}" ] && \
48 systemctl preset ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}
48 49
49 if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then 50 if [ "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
50 systemctl --no-block restart ${SYSTEMD_SERVICE_ESCAPED} 51 [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}" ] && \
52 systemctl --no-block restart ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}
51 fi 53 fi
52 fi 54 fi
53fi 55fi
@@ -56,9 +58,10 @@ fi
56systemd_prerm() { 58systemd_prerm() {
57if systemctl >/dev/null 2>/dev/null; then 59if systemctl >/dev/null 2>/dev/null; then
58 if [ -z "$D" ]; then 60 if [ -z "$D" ]; then
59 systemctl stop ${SYSTEMD_SERVICE_ESCAPED} 61 if [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}" ]; then
60 62 systemctl stop ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}
61 systemctl disable ${SYSTEMD_SERVICE_ESCAPED} 63 systemctl disable ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", False, d)}
64 fi
62 fi 65 fi
63fi 66fi
64} 67}
@@ -108,6 +111,9 @@ def systemd_service_exists(service, user, d):
108 111
109 return path != '' 112 return path != ''
110 113
114def systemd_filter_services(services, user, d):
115 return ' '.join(service for service in services.split() if systemd_service_exists(service, user, d))
116
111python systemd_populate_packages() { 117python systemd_populate_packages() {
112 import re 118 import re
113 import shlex 119 import shlex