File tree Expand file tree Collapse file tree
modules/share/airootfs.any/root Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,21 +92,11 @@ _safe_systemctl(){
9292 local _service _command=" ${1} "
9393 shift 1
9494 for _service in " ${@ } " ; do
95- # https://unix.stackexchange.com/questions/539147/systemctl-check-if-a-unit-service-or-target-exists
96- if (( "$(systemctl list- unit- files "${_service} " | wc - l)" > 3 )) ; then
97- if [[ " ${_command} " = " enable" ]]; then
98- if [[ " $( systemctl is-enabled " ${_service} " ) " = " enabled" ]]; then
99- echo " ${_service} has been enabled" >&2
100- else
101- systemctl enable " ${_service} " || true
102- fi
103- else
104- systemctl " ${_command} " " ${_service} "
105- fi
106- elif echo " ${_service} " | grep -q " @" ; then
107- _safe_systemctl " ${_command} " " $( echo " ${_service} " | cut -d " @" -f 1) "
108- else
109- echo " ${_service} was not found" >&2
95+ if [[ " ${_command} " = " enable" ]] && [[ " $( systemctl is-enabled " ${_service} " ) " = " enabled" ]]; then
96+ echo " ${_service} has been enabled" >&2
97+ continue
11098 fi
99+ systemctl " ${_command} " " ${_service} " || true
111100 done
101+ return 0
112102}
You can’t perform that action at this time.
0 commit comments