shell - Run some commands in Debian package script from current user -


how run commands in installations scripts of deb-package (preinst, postinst, prerm, postrm) not root current user (user invoked installation)?

root current user. should never expect installation of package performed sudo

you can check sudo_user environment variable user may have invoked script, if installation performed context of simple sudo dpkg -i - sudo may not have been installed, installation may have been performed su, means environment variable not set.

if want invoke scripts user invert sudo - viz:

sudo -u $sudo_user -c <command invoke> 

but need ensure know user invoked script - i.e. sudo_user root!

typically, though, because can have arbitrary number of users on linux system, should not this, leave system in state 1 user can use package. should create state/configuration on first invocation ordinary user.

finally, don't expect gui, don't expect terminal on installation if it's being shipped dpkg.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -