fixes systemctl issue in get_systemd_service_file for containerized scan which cannot run systemctl show -p FragmentPath. Includes improvement when reporting Files not found.

This commit is contained in:
rezroo 2019-08-04 01:27:38 +00:00
commit bd5d2e82ba
3 changed files with 46 additions and 44 deletions

View file

@ -105,6 +105,8 @@ get_systemd_service_file() {
echo "/etc/systemd/system/$SERVICE"
elif systemctl show -p FragmentPath "$SERVICE" 2> /dev/null 1>&2; then
systemctl show -p FragmentPath "$SERVICE" | sed 's/.*=//'
elif [ -f "/lib/systemd/system/$SERVICE" ]; then
echo "/lib/systemd/system/$SERVICE"
else
echo "/usr/lib/systemd/system/$SERVICE"
fi