Page 1 of 1

How to use fake root to build packages

Posted: 3. Oct 2009, 09:16
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 ?

Re: How to use fake root to build packages

Posted: 3. Oct 2009, 12:01
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

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 12:56
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

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 14:02
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'

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 14:51
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.

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 17:01
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?

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 17:06
by damNageHack

Code: Select all

fakeroot touch /tmp/bla
Just works.

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 20:03
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: ).

Re: How to use fake root to build packages

Posted: 1. Jan 2010, 23:52
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. ;)