There is a foo.tar.gz source it will install to /lib/modules. But, I'm not root haven't enough permission. I'm try to write a script to automatic build the package.
#!/bin/bash
tar xf foo.tar.gz
cd foo
make
fakeroot make install
It shows
mkdir: cannot create directory `/lib/modules/foo.so
I don't want to really put in /lib, maybe I could put in $HOME/rootfs.
What is the correct method to use fakeroot? Or, is there a simple script could let me trace how to use fakeroot?
You are confused about the role of
fakeroot. It is not used to elevate privilges to root in order to install a package. It is used when a package is created. Since you are not creating a package, there is nothingfakerootcan do for you. See also this description of fakeroot.To temporarily elevate privileges, you should use
sudo.