Recent

Author Topic: How to deploy fpc/lazarus programs on Linux?  (Read 1193 times)

BosseB

  • Sr. Member
  • ****
  • Posts: 468
How to deploy fpc/lazarus programs on Linux?
« 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?
--
Bo Berglund
Sweden

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #1 on: November 20, 2019, 09:38:24 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #2 on: November 21, 2019, 02:07:07 pm »
To know where each thing goes (and why) you should read the Filesystem Hierarchy Standard. Most current Linux distros adhere to it.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #3 on: November 21, 2019, 02:46:43 pm »
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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #4 on: November 21, 2019, 05:07:27 pm »
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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

guest64953

  • Guest
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #5 on: November 21, 2019, 05:50:23 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?

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.

guest64953

  • Guest
Re: How to deploy fpc/lazarus programs on Linux?
« Reply #6 on: November 21, 2019, 05:53:02 pm »
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.

 

TinyPortal © 2005-2018