Recent

Author Topic: Installing Lazarus Packages System-wide  (Read 3629 times)

TheChymera

  • Newbie
  • Posts: 6
Installing Lazarus Packages System-wide
« on: September 21, 2018, 11:36:10 pm »
I am trying to make a system-wide Lazarus installation (with a package) consistent with (Gentoo) Linux best practices:

(a) system-wide usable files should only be added/removed/changed by the package manager
(b) that was it, huh?

The way I currently manage this is:

(1) I install the Lazarus package with

Code: Text  [Select][+][-]
  1. lazbuild -B --lazarusdir="." --pcp="/etc/lazarus" --build-ide= --add-package Python-for-Lazarus/python4lazarus/python4lazarus_package.lpk

(2) I launch Lazarus with

Code: Pascal  [Select][+][-]
  1. startlazarus

and I get

Code: Pascal  [Select][+][-]
  1. The package "python4lazarus_package" is installed, but no valid package file (.lpk) was found.
  2. A broken dummy package was created.
  3.  


This, however, only happens if I run startlazarus as my user. Run as root, it detects the package just fine.
Changing the PCP permissions:

Code: Pascal  [Select][+][-]
  1. chmod -R 777 /etc/lazarus

Makes it also work as user.

This is however not a suitable solution, since any user could modify the files. A Lazarus installation which my package manager knows has python4lazarus support, could have the python4lazarus removed by a user, and would break anything that depends on the feature.


How would you suggest I address this? I had thought that
Code: Pascal  [Select][+][-]
  1. /etc/lazarus
could be copied to
Code: Pascal  [Select][+][-]
  1. ~/.lazarus
whenever Lazarus is first launched. I could do this via a wrapper easily enough, but that would't really suffice. I would need to do the same at least for lazbuild as well and perhaps also other stuff, and it might break in the future contingent on what other executables you might add. I was thinking maybe you have a more sustainable suggestion?

I have read this page, and it sounds like it should “just work”, except it appears that if it doesn't have permission to read /etc/lazarus startlazarus creates a no-package-containing directory under ~/.lazarus, instead of copying /etc/lazarus/ (which it can) and taking it from there. Is there any way to instruct it to do so?

TheChymera

  • Newbie
  • Posts: 6
Re: Installing Lazarus Packages System-wide
« Reply #1 on: September 22, 2018, 12:20:43 am »
copying /etc/lazarus manually to ~/.lazarus solves the issue (but ideally this should be done automatically when lazarus is started), but I get this pop-up. It would be even cooler if it didn't appear. Would any solution to the aforementioned issue also prevent the pop-up?

Code: Pascal  [Select][+][-]
  1. Welcome to Lazarus 1.8.4
  2.  
  3. There is already a configuration from version prior 1.8.4 in
  4. /home/chymera/.lazarus
  5. The old configuration will be upgraded.
  6.  
  7. If you want to use two different Lazarus versions you must start the second Lazarus with the command line parameter primary-config-path or pcp.
  8.  
  9. For example:
  10. /usr/share/lazarus/startlazarus --pcp=~/.lazarus_test

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Installing Lazarus Packages System-wide
« Reply #2 on: September 22, 2018, 09:45:55 am »
You must study the sources about PrimaryConfigPath and SecondaryConfigPath etc.
I guess it should be improved. Maybe you can figure out what goes on there.
« Last Edit: September 22, 2018, 10:06:40 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

TheChymera

  • Newbie
  • Posts: 6
Re: Installing Lazarus Packages System-wide
« Reply #3 on: September 24, 2018, 12:44:19 am »
Ok, I was able to solve issue by switching the default PCP and SCP (that way by default the system install is used) Ofc it's not editable, so if that is needed /etc/lazarus needs to be manually copied to ~/.lazarus .  This actually should/needs to be done manually, since writing anything automatically to the user's home dir, may modify the user's files outside of his view.

The fix was (before building):
Code: Pascal  [Select][+][-]
  1.         sed -i \
  2.                 -e "s;SecondaryConfigPath:='/etc/lazarus';SecondaryConfigPath:=ExpandFileNameUTF8('~/.lazarus');g" \
  3.                 -e "s;PrimaryConfigPath:=ExpandFileNameUTF8('~/.lazarus');PrimaryConfigPath:='/etc/lazarus';g" \
  4.                 ide/include/unix/lazbaseconf.inc
  5.  

 

TinyPortal © 2005-2018