You are not logged in.

#1 2017-06-22 17:21:33

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 102

[SOLVED] post_install as standard user

For one of my package, in PKGBUILD I have registered an install script. In that script I have defined a post_install function which seems to be executed as root. Is there anyway to make it run as standard user?

Last edited by EgidioCaprino (2017-06-22 17:30:30)

Offline

#2 2017-06-22 17:23:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: [SOLVED] post_install as standard user

No

Offline

#3 2017-06-22 19:35:56

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,920

Re: [SOLVED] post_install as standard user

EgidioCaprino,

If that script needs to run as user you can put it in /usr/bin/ and inform the user they need to run it manually.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2017-06-23 17:58:13

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: [SOLVED] post_install as standard user

At the risk of patronizing, note you can use runuser(1) to run specific commands as a given user while root.
Of course, you would need to know which user, so this PKGBUILD would probably only be for yourself in that case smile

Last edited by GenkiSky (2017-06-23 18:08:20)

Offline

#5 2017-06-25 05:33:36

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] post_install as standard user

Of course, any package that runs commands in the post_install as some user is undoubtedly setting a variable in the install scriptlet via sed and the $USER variable that makepkg was run as. Which both forbidden and horribly inaccurate.

And any such package is flagrantly violating packaging guidelines, and if the maintainer refuses to fix that problem by ceasing to do so, it will be either deleted from the AUR or forcibly removed from the maintainer and given over to some other AUR user who is willing to maintain it in a more responsible fashion.

There is no justifiable reason for running commands as non-root in a package post_install, and any conceivable circumstance should instead exist as a post_install message echoed to the user's eyeballs.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB