Lazarus
Programming => General => Topic started by: BosseB on November 20, 2019, 09:16:29 pm
-
I am wondering how exactly I should package the program I am developing for Raspberry Pi so it can be installed and uninstalled on Raspberry Pi units in the proper way...
The program is an Arm binary for RPi3 or Rpi4 type units running Raspbian Buster.
So I could stuff the binary into /usr/bin I suppose, but it also needs a config file (below /etc, right?) and some data files which go into a new directory tree somewhere (where?).
The dir (which needs to be created) shall be populated with some example files and such.
And this is a pure command line application meant to be run from cron or possibly as a service. Not sure yet.
On Windows for my previous Delphi applications I used InnoSetup but that is not valid on Linux of course.
My aim is to get a way to install which will help the production and service people when we move away from using Windows PC as a platform for automation.
Needless to say I am not so familiar with everyday use/maintenance of Linux computers. I have only used RPi boxes for dev work (fpc/lazarus) and experimentation so far....
Or should I simply write some FPC command line utility to do the job?
Or maybe an install shellscript and put that into a tgz file?
What do people normally do?
-
Binary in /usr/local/bin (or /usr/local/sbin if it's for root only). Make sure that the user has this on the path. Global configuration in /usr/local/etc, per-user configuration created in ~/.config on first run but always ask the user's permission to create any file/directory.
You could potentially use /opt rather than /usr/local but you'd be less likely to find that on the path.
How you actually package your binary for distribution is distro-specific, but on Raspbian you'd typically use a .deb
MarkMLl
-
To know where each thing goes (and why) you should read the Filesystem Hierarchy Standard (https://refspecs.linuxfoundation.org/fhs.shtml). Most current Linux distros adhere to it.
-
Except that various distreaux have- since the publication of that document- started making noises about deprecating the entire /usr tree and replacing e.g. /usr/bin with a symlink to /bin.
I'm not saying that the document is wrong: from my POV it's sensible and fairly conservative. But at the moment you can't trust it as entirely reliable.
MarkMLl
-
I'm not saying that the document is wrong: from my POV it's sensible and fairly conservative. But at the moment you can't trust it as entirely reliable.
Not entirely; as most Linux "standards" it quite depends on the distro. But as a first (and oftentimes "only") approximation is where one should go. Then one should read the distro's packaging and maintainers docs (if any), to see the specifics.
-
I am wondering how exactly I should package the program I am developing for Raspberry Pi so it can be installed and uninstalled on Raspberry Pi units in the proper way...
The program is an Arm binary for RPi3 or Rpi4 type units running Raspbian Buster.
So I could stuff the binary into /usr/bin I suppose, but it also needs a config file (below /etc, right?) and some data files which go into a new directory tree somewhere (where?).
The dir (which needs to be created) shall be populated with some example files and such.
And this is a pure command line application meant to be run from cron or possibly as a service. Not sure yet.
On Windows for my previous Delphi applications I used InnoSetup but that is not valid on Linux of course.
My aim is to get a way to install which will help the production and service people when we move away from using Windows PC as a platform for automation.
Needless to say I am not so familiar with everyday use/maintenance of Linux computers. I have only used RPi boxes for dev work (fpc/lazarus) and experimentation so far....
Or should I simply write some FPC command line utility to do the job?
Or maybe an install shellscript and put that into a tgz file?
What do people normally do?
If you can, create a deb package. If you don't want wasting time to learn Debian packaging, just ship a big tar.gz file, when the user extracted this archive he will have a install.sh script, then he will use this script to install your program.
-
Binary in /usr/local/bin (or /usr/local/sbin if it's for root only). Make sure that the user has this on the path. Global configuration in /usr/local/etc, per-user configuration created in ~/.config on first run but always ask the user's permission to create any file/directory.
You could potentially use /opt rather than /usr/local but you'd be less likely to find that on the path.
How you actually package your binary for distribution is distro-specific, but on Raspbian you'd typically use a .deb
MarkMLl
I think third party applications usually be installed on /opt. We could ask the user to add our program's binary to the PATH environment variable. It's easily done via .bashrc.