Skip to content

Commit c594fc9

Browse files
committed
[fix] : Fixed systemd for alias unit
1 parent ff2a444 commit c594fc9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

modules/share/airootfs.any/root/functions.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ _safe_systemctl(){
9595
# https://unix.stackexchange.com/questions/539147/systemctl-check-if-a-unit-service-or-target-exists
9696
if (( "$(systemctl list-unit-files "${_service}" | wc -l)" > 3 )); then
9797
if [[ "${_command}" = "enable" ]]; then
98-
if [[ "$(systemctl is-enabled "${_service}")" = "disabled" ]]; then
99-
systemctl enable "${_service}"
100-
else
98+
if [[ "$(systemctl is-enabled "${_service}")" = "enabled" ]]; then
10199
echo "${_service} has been enabled" >&2
100+
else
101+
systemctl enable "${_service}" || true
102102
fi
103103
else
104104
systemctl "${_command}" "${_service}"

0 commit comments

Comments
 (0)