[Debian-med-packaging] Bug#739657: gnuhealth-server: fails to install: gnuhealth-server.postinst: sudo: not found
Andreas Tille
andreas at an3as.eu
Sun Feb 23 07:38:56 UTC 2014
On Sat, Feb 22, 2014 at 08:36:58PM +0100, Emilien Klein wrote:
> I assumed/believed sudo was part of the "base" Debian system, as I don't
> have issues when building the package with pbuilder.
> I indeed want to execute those commands as the user that owns the database.
>
> I understood sudo (su DO) was meant to execute commands as another user,
> while su is used to "become" another user. Granted, with `su -c` you can
> execute a command as another user.
>
> Extract from the manpages:
> sudo:
> sudo, sudoedit - execute a command as another user
I'd call this a bit confusing since sudo is the command to do something
as superuser.
> su:
> su - change user ID or become superuser
> OPTIONS
> -c, --command COMMAND
> Specify a command that will be invoked by the shell using its -c.
su belongs to (any POSIX) standard system and if you are keep on reading
its manpage it says:
The su command is used to become another user during a login session. Invoked without a username, su
defaults to becoming the superuser. The optional argument - may be used to provide an environment
similar to what the user would expect had the user logged in directly.
so the `username` parameter is what you want to use to become the dbuser
in your script. The sudo command is something to *become* root but when
you are executing the install scripts of a Debian package you just *are*
root.
> I am wondering what the most appropriate command is to perform this task.
> Is the solution to:
> - Depend on sudo
> - Use su to execute that command
The later as I said in my previous mail.
Kind regards
Andreas.
--
http://fam-tille.de
More information about the Debian-med-packaging
mailing list