deajan / pmOCR

A wrapper for tesseract / abbyyOCR11 ocr4linux finereader cli that can perform batch operations or monitor a directory and launch an OCR conversion on file activity
BSD 3-Clause "New" or "Revised" License
64 stars 15 forks source link

install.sh: check destination for SERVICE_DIR_SYSTEMD_SYSTEM #4

Closed popnt closed 8 years ago

popnt commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Can you confirm latest commits work for you ?

popnt commented 8 years ago

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 commented 8 years ago

Anyway, thanks :)