Recent

Author Topic: Creating .deb packages for Lazarus applications?  (Read 18798 times)

dbannon

  • Hero Member
  • *****
  • Posts: 1294
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #45 on: November 22, 2020, 08:23:49 am »
I repeat -

Don't forget linux/unix is a multiuser system, once installed, an application should be usable by every user, including ones who did not exist when the application was first installed.

Packages such as debs should not mess around in user space !   Unix systems have all sorts of 'users' installed that are not real users and you risk the wrath of a leather winged dragon from hell if you mess around with their accounts. Its the wrong thing to do.

Its very, very easy to make your app prepare the end user env at first start up -

Does config file exist ?
Yes - read it and use it.
No - create a default config file

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

lucamar

  • Hero Member
  • *****
  • Posts: 3600
Re: Creating .deb packages for Lazarus applications?
« Reply #46 on: November 22, 2020, 01:10:01 pm »
==> I'm coming back to the lack of a record somewhere in Linux of who was actively logged in, before the root installation [...]

Calling fpGetuid() should give that, as fpGeteuid() should give you the "root" id. The installation runs as root but the real id should still be that of the user who launched it.

But Davo is right: normal user configuration should be deferred until first run and if you have assets that are the same for all users, like images, sounds, etc., they should be copied to the programs folder in /usr/share at install-time, which means your .deb file should reflect this.
« Last Edit: November 22, 2020, 01:14:12 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

circular

  • Hero Member
  • *****
  • Posts: 3666
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #47 on: November 22, 2020, 01:19:57 pm »
Unix systems have all sorts of 'users' installed that are not real users and you risk the wrath of a leather winged dragon from hell if you mess around with their accounts.
Isn't it a bit overdramatic?
Conscience is the debugger of the mind

PascalDragon

  • Hero Member
  • *****
  • Posts: 2751
  • Compiler Developer
Re: Creating .deb packages for Lazarus applications?
« Reply #48 on: November 22, 2020, 01:22:19 pm »
Unix systems have all sorts of 'users' installed that are not real users and you risk the wrath of a leather winged dragon from hell if you mess around with their accounts.
Isn't it a bit overdramatic?

I'd even go so far as to say that dbannon underestimated that...

circular

  • Hero Member
  • *****
  • Posts: 3666
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #49 on: November 22, 2020, 01:24:58 pm »
As a Dragon, I suspect that you opinion is biased.
Conscience is the debugger of the mind

devEric69

  • Sr. Member
  • ****
  • Posts: 433
Re: Creating .deb packages for Lazarus applications?
« Reply #50 on: February 03, 2021, 09:36:49 pm »
Hello,

I'm trying to create a Linux installation, with a system user (adduser --system ...\... a_software_usr). a_software_usr represents the installed software (my_software's proxy, an abstraction of other real users). Then, I've created a single-user software group named a_software_grp containing a_software_usr. I've installed \ dispatched all the binaries released in /opt/my_software/... . Then, I've added the real users - detected during the installation - inside the group named a_software_grp. I'm using setfacl cmd to manage rights on /opt/my_software/... .

I've then said that the /opt/my_software directory belongs, is owned by a_software_usr:a_software_grp. I, i.e. user01, as a real user (not a system user), also belong to a_software_grp. In other words, I use a_software_grp as a proxy group to manage the rights dispatched into /opt/my_software. And real users who want to run a_software, must be added inside this group.

I've got the following problem: in summary, if the permissions given on /opt/a_software are [rwx rwx rwx] i.e. [777], I can launch a_software from a menu launching itself /usr/share/applications/a_software.desktop. But, if I grant /opt/a_software with a less permissive installation, i.e. if the permissions given on /opt/a_software are [rwx rwx ---] i.e. [770], then I get the message "Desktop file invalid: '/usr/share/applications/a_software.desktop'". Same thing: when I run a_software with [770] rights, from a terminal as @user01 or as @root, I get the message "Gtk-WARNING **: 21:02:36.872: cannot open display: ".

Does someone have a clue \ hint, where to look for the reason of this message?
« Last Edit: February 03, 2021, 10:31:56 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

devEric69

  • Sr. Member
  • ****
  • Posts: 433
Re: Creating .deb packages for Lazarus applications?
« Reply #51 on: February 04, 2021, 10:53:35 am »
Okay, it's my fault:

I restarted the commands...

Code: Bash  [Select][+][-]
  1. find "${OPT_DIR_OF_A_APPLICATION}" -type d -exec chmod 0755 {} \; #set directory attributes
  2. find "${OPT_DIR_OF_A_APPLICATION}". -type f -exec chmod 0644 {} \; #set data file attributes
  3. find "${OPT_DIR_OF_A_APPLICATION}/usr/bin" -type f -exec chmod 0755 {} \; #set executable attributes

...in a post-install script embedded in the installation package, to give the same adhoc rights such as described in the paragraph § "Finalizing the staging directory" of the page https://wiki.lazarus.freepascal.org/Debian_package_structure, and the application is launched again well, from a menu. So, the problem of mandating the installation by a system user and a representation group are transparent if I respect the same rights.

Nevertheless, even with the good rights, I always have the problem of launching in a terminal that persists, i.e. I get the message "Gtk-WARNING **: 10:26:05.756: cannot open display:". I can't launch, too, some utilities like xeyes, xclock from a terminal ("Error: Can't open display:"), on a new ghost image of Debian 10 Buster (for information). Of course, it's no longer really a problem of installation, but rather a problem of launching a visual application from a terminal. If anyone have a hint about Xorg \ X11...?
« Last Edit: February 04, 2021, 04:16:56 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

devEric69

  • Sr. Member
  • ****
  • Posts: 433
Re: Creating .deb packages for Lazarus applications?
« Reply #52 on: February 04, 2021, 12:26:21 pm »
For information, found on the web: "Graphics applications must be launched by the user who opened the X session. So you should not launch (in a terminal) as root or any other user, but only with the connected one (without su or sudo).".

So...:
- I restarted a terminal as @user01, not as @root, like I used to do.
- I started the cmd: export DISPLAY=:0.0
- I ran the cmd: xclock
...and the small GUI clock, now starts and displays itself. Same thing for the application I'm trying to correctly install (more important, I now see in the terminal the notification messages, OS layer errors, etc).
« Last Edit: February 04, 2021, 04:17:07 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

circular

  • Hero Member
  • *****
  • Posts: 3666
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #53 on: February 05, 2021, 02:59:16 am »
Interesting to know that those rights can have such surprising side effects.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018