From 4e414f51ef4ad64dee3c7747d0e78ab53c1f80b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Mon, 14 Dec 2015 20:27:10 +0100 Subject: [PATCH] check /etc/systemd/system/ before systemctl, /usr/lib/systemd/ fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- helper_lib.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/helper_lib.sh b/helper_lib.sh index ed966ab..74c8849 100644 --- a/helper_lib.sh +++ b/helper_lib.sh @@ -89,10 +89,11 @@ get_docker_effective_command_line_args() { get_systemd_service_file(){ SERVICE="$1" - systemctl show -p FragmentPath "$SERVICE" 2> /dev/null 1>&2 - if [ $? -eq 0 ]; then - systemctl show -p FragmentPath "$SERVICE" | sed 's/.*=//' + if [ -f "/etc/systemd/system/$SERVICE" ]; then + echo "/etc/systemd/system/$SERVICE" + elif systemctl show -p FragmentPath "$SERVICE" 2> /dev/null 1>&2; then + systemctl show -p FragmentPath "$SERVICE" | sed 's/.*=//' else - echo "/usr/lib/systemd/system/$SERVICE" + echo "/usr/lib/systemd/system/$SERVICE" fi }