Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

install.sh: check destination for SERVICE_DIR_SYSTEMD_SYSTEM #4

Closed
popnt opened this issue May 13, 2016 · 6 comments
Closed

install.sh: check destination for SERVICE_DIR_SYSTEMD_SYSTEM #4

popnt opened this issue May 13, 2016 · 6 comments

Comments

@popnt
Copy link

popnt commented May 13, 2016

The install.sh script points to /usr/lib/systemd/system to copy the pmocr-srv.service file however it would appear that not all distros have that folder by default. I'm running Debian on Raspberry Pi (aka Raspbian)

I'm not familiar enough with other distros to know where the optimal location for that the *.service files would be but install.sh stores SERVICE_DIR_SYSTEMD_USER under /etc/systemd/user which resides alongside /etc/systemd/system

So I'm not sure what advantage there would be to keeping the service files under /usr/lib/systemd/system instead of /etc/systemd/system but checking if the /usr/lib/systemd/system folder exists first would ensure that line 133 in install.sh does not copy the file to the wrong location.

@deajan
Copy link
Owner

deajan commented May 13, 2016

Fact is that /etc/systemd is a symlink on redhat / centos / fedora* that points to /usr/lib/systemd.
Could you tell me if the Debian version of that dir is a link, and in that case, give me the destination ?

@popnt
Copy link
Author

popnt commented May 15, 2016

On the debian distro I'm using, it is a regular diretory under /etc/systemd

The systemd man page for file-hierarchy will probably be a better reference than an individual distro. To me it sounds like /etc/ is where all the system specific individual configs are located, whereas /usr/lib us where all the distro-specific configs are located. Clearly redhat does things their own way as you have described.

when I ran install.sh it just copied pmocr-srv.service to the /usr/lib/systemd/ folder and named the destination file "system" since the directory didn't exist. Switching the SERVICE_DIR_SYSTEMD_SYSTEM target to /etc/systemd/system resulted in the correct copy operation

A more common Debian distro to compare against might be Ubuntu, however a cheap OCR server on a Raspberry is also pretty handy use of $35 especially when paired with a cheap duplexing scanner.

Very useful script! Thanks for making it easy to read through all the code.

@deajan
Copy link
Owner

deajan commented May 24, 2016

Well, according to this, /usr/lib/systemd/system is a good place to place unit files. I wonder why Debian doesn't have that.

A good compromise would be to put files in /lib/systemd/system which works for both CentOS (/lib is a symlink to /usr/lib in CentOS) and Debian without using /etc/systemd/system path which isn't supposed to be used by installed packages.

I've setup a debian 8 VM to test this, seems to work.
Seems that redhat doesn't do things their own way after all.

@deajan
Copy link
Owner

deajan commented May 25, 2016

Can you confirm latest commits work for you ?

@popnt
Copy link
Author

popnt commented Jun 1, 2016

For my own installation I simply modified the install.sh code from build 2016050901 to reflect /etc/systemd/system and it works fine for me. Since I am already using it in a production environment and it works well I hesitate to reinstall just to test.

That being said I did take a look at my local /lib/systemd/system used in build 2016052501 and there are numerous .service files there as well, so I'll hazard a guess that using that directory will be effective.

If I do end up having to reinstall or upgrade following any future commits I'll keep an eye on that element and update this thread. I suspect it will work perfectly.

Thanks for taking a look at this!

@deajan
Copy link
Owner

deajan commented Jun 1, 2016

Anyway, thanks :)

@deajan deajan closed this as completed Jun 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants