How to use fake root to build packages

General talk about packaging procedures and packages.
Post Reply
ajaykumar.mysore
Posts: 21
Joined: 24. Sep 2009, 06:24

How to use fake root to build packages

Post by ajaykumar.mysore »

Hi,
Our sir told me to use the fake root for doing packages instead of getting logged in as root. But can any one guide me how to use fake root ?
User avatar
laprjns
Salix Warrior
Posts: 1112
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: How to use fake root to build packages

Post by laprjns »

I just learned about this also from the other thread. I figured out how to use fakeroot by reading the man page (man fakeroot). Here's how I do it.
fakeroot slkbuild
If you don't use slkbuild, then just insert the build script file name instead.
You might also want to consider Shador's method
Shador wrote: I do: ;)
alias build="fakeroot slkbuild -X"
I just inserted this line my users ~.bashrc file.
Rich
Last edited by laprjns on 1. Jan 2010, 15:21, edited 1 time in total.
“The past was erased, the erasure was forgotten, the lie became the truth.”
― George Orwell, 1984
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to use fake root to build packages

Post by damNageHack »

I am using a build script from zenwalk with handles with the binaries release of apache-ant.
fakeroot seemes not to work here with makepkg and other stuff ...
$ fakeroot ./build-ant.sh
(...)
ln: Erzeuge symbolische Verknüpfung „./WHATSNEW“: Keine Berechtigung
cp: reguläre Datei „/tmp/package-ant/usr/src/ant-1.7.1/build-ant.sh“ kann nicht angelegt werden: Keine Berechtigung
./build-ant.sh: line 105: /tmp/package-ant/install/slack-desc: Keine Berechtigung
./build-ant.sh: line 131: /tmp/package-ant/install/doinst.sh: Keine Berechtigung
./build-ant.sh: line 151: makepkg: command not found
Image
This is the oppinion of the author, it does not force you to share and is signed automatically.
You are free to keep them all errors for your own. Linux is the best game I ever played.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: How to use fake root to build packages

Post by Shador »

damNageHack wrote:I am using a build script from zenwalk with handles with the binaries release of apache-ant.
fakeroot seemes not to work here with makepkg and other stuff ...
$ fakeroot ./build-ant.sh
(...)
ln: Erzeuge symbolische Verknüpfung „./WHATSNEW“: Keine Berechtigung
cp: reguläre Datei „/tmp/package-ant/usr/src/ant-1.7.1/build-ant.sh“ kann nicht angelegt werden: Keine Berechtigung
./build-ant.sh: line 105: /tmp/package-ant/install/slack-desc: Keine Berechtigung
./build-ant.sh: line 131: /tmp/package-ant/install/doinst.sh: Keine Berechtigung
./build-ant.sh: line 151: makepkg: command not found
This sounds like your user hadn't access to /tmp. Is that possible?
The problem with makepkg is that many packagers just invoke 'makepkg' relying on PATH. But fakeroot doesn't touch PATH (i.e. it's still a user's PATH), so to make it work you just have to replace it with '/sbin/makepkg'
Image
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to use fake root to build packages

Post by damNageHack »

Shador wrote: This sounds like your user hadn't access to /tmp. Is that possible?
Nope.
$ ls -ld /tmp/
drwxrwxrwt 11 root root 420 2010-01-01 15:18 /tmp/
$ mount |grep tmp
tmpfs on /dev/shm type tmpfs (rw)
none on /tmp type tmpfs (rw)
Shador wrote:The problem with makepkg is that many packagers just invoke 'makepkg' relying on PATH. But fakeroot doesn't touch PATH (i.e. it's still a user's PATH), so to make it work you just have to replace it with '/sbin/makepkg'
Done. But /tmp problem still exists.
Image
This is the oppinion of the author, it does not force you to share and is signed automatically.
You are free to keep them all errors for your own. Linux is the best game I ever played.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: How to use fake root to build packages

Post by Shador »

I don't know what the script is trying to do at those lines, but it definitely is some kind of permission problem.
touch /tmp/somefile works too?
Image
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to use fake root to build packages

Post by damNageHack »

Code: Select all

fakeroot touch /tmp/bla
Just works.
Image
This is the oppinion of the author, it does not force you to share and is signed automatically.
You are free to keep them all errors for your own. Linux is the best game I ever played.
User avatar
damNageHack
Posts: 663
Joined: 24. Sep 2009, 17:07

Re: How to use fake root to build packages

Post by damNageHack »

Shador wrote:I don't know what the script is trying to do at those lines, but it definitely is some kind of permission problem.
Yes. On the other machine, it works perfectly. So I assume a configuration problem caused by the user (me in this case :lol: ).
Image
This is the oppinion of the author, it does not force you to share and is signed automatically.
You are free to keep them all errors for your own. Linux is the best game I ever played.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: How to use fake root to build packages

Post by Shador »

damNageHack wrote:
Shador wrote:I don't know what the script is trying to do at those lines, but it definitely is some kind of permission problem.
Yes. On the other machine, it works perfectly. So I assume a configuration problem caused by the user (me in this case :lol: ).
No problem. ;)
Image
Post Reply