Should I login as root while creating packages?

General talk about packaging procedures and packages.
rsamurti
Posts: 11
Joined: 22. Sep 2009, 15:24

Should I login as root while creating packages?

Post by rsamurti » 26. Sep 2009, 11:29

Hello,

Please pardon me if this question sounds very silly.

I have a basic doubt. To create packages, I need to use the command makepkg which is not available when I have logged in as a non-root user. So, should I always login as root while creating packages or is there any other way to do it?

Thanks for your help.

Anand

User avatar
gapan
Salix Wizard
Posts: 5503
Joined: 6. Jun 2009, 17:40

Re: Should I login as root while creating packages?

Post by gapan » 26. Sep 2009, 11:40

I recommend you use fakeroot, like this:

Code: Select all

fakeroot name.SlackBuild 2>&1 | tee build-name.log
so you can also have a build log. In that case, you should specify makepkg with a full path in the Slackbuild:

Code: Select all

/sbin/makepkg -l y -c n ...
Using fakeroot has the huge advantage that if something tries to install in you system instead of the packaging directory, you'll get an error and there is no chance that it will slip out.
Image
Image

User avatar
JRD
Salix Warrior
Posts: 949
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Should I login as root while creating packages?

Post by JRD » 28. Sep 2009, 07:43

Or event better :
(OLDPATH=$PATH; PATH=/sbin:/usr/sbin/:$PATH; fakeroot name.Slackbuild 2>&1 | tee build-name.log; PATH=$OLDPATH; unset OLDPATH)
Image

User avatar
john256
Posts: 89
Joined: 1. Jun 2011, 07:52

Re: Should I login as root while creating packages?

Post by john256 » 17. Jan 2015, 14:51

gapan wrote:I recommend you use fakeroot, like this:

Code: Select all

fakeroot name.Slackbuild 2>&1 | tee build-name.log
so you can also have a build log. In that case, you should specify makepkg with a full path in the Slackbuild:

Code: Select all

/sbin/makepkg -l y -c n ...
Using fakeroot has the huge advantage that if something tries to install in you system instead of the packaging directory, you'll get an error and there is no chance that it will slip out.
Sorry for picking up this ancient thread, but I'd like to know - is this still the recommended way building packages (apart from using sourcery)?

User avatar
gapan
Salix Wizard
Posts: 5503
Joined: 6. Jun 2009, 17:40

Re: Should I login as root while creating packages?

Post by gapan » 17. Jan 2015, 17:46

Yes.
Image
Image

User avatar
john256
Posts: 89
Joined: 1. Jun 2011, 07:52

Re: Should I login as root while creating packages?

Post by john256 » 25. Jan 2015, 13:02

I have tried to build a newer git using Pat's slackBuild from here, but when I run it as recommended:

Code: Select all

fakeroot git.Slackbuild 2>&1 | tee git-1.9.0-build.log
I get the following error:

Code: Select all

/usr/bin/fakeroot: line 178: git.Slackbuild: command not found
What am I doing wrong?
Note that I have also used also JRD's suggestion from this thread, but got the same error.

User avatar
gapan
Salix Wizard
Posts: 5503
Joined: 6. Jun 2009, 17:40

Re: Should I login as root while creating packages?

Post by gapan » 25. Jan 2015, 13:55

Code: Select all

chmod +x git.SlackBuild
Image
Image

User avatar
john256
Posts: 89
Joined: 1. Jun 2011, 07:52

Re: Should I login as root while creating packages?

Post by john256 » 25. Jan 2015, 19:18

It is:

Code: Select all

-rwxr-xr-x  1 jjbj users    4863 Jan 25 14:52 git.SlackBuild

User avatar
gapan
Salix Wizard
Posts: 5503
Joined: 6. Jun 2009, 17:40

Re: Should I login as root while creating packages?

Post by gapan » 25. Jan 2015, 20:50

Isn't the current dir in your $PATH?

Try:

Code: Select all

fakeroot ./git.Slackbuild 2>&1 | tee git-1.9.0-build.log
Image
Image

User avatar
john256
Posts: 89
Joined: 1. Jun 2011, 07:52

Re: Should I login as root while creating packages?

Post by john256 » 25. Jan 2015, 20:55

It isn't on the $PATH, but adding "./" as you suggested brought up the same error message.

Post Reply