I'm in the process of building bash-script based installer that needs to set up a systemd unit among other things. I could hard-code the typical systemd unit file locations like /etc/systemd/system
or /usr/lib/systemd/system
but I'd like to be able to have the script be able to detect the system's preferred location for adding a new unit file and service.
I could certainly do this by using find
and looking for existing service unit files, but I wanted to avoid adding too much complexity if there's already an existing global variable (like $HOME
) I could call on