2012年3月23日星期五

Let fakeroot keep file attributes between sessions

By default, fakeroot keeps file attributes in memory. So when a session exit, attributes lost.
I met this problem when modifying a rootfs directory. Attributes of files in "/dev"  always lost when initial session exit.
A quick and dirty hack is to add this line to .bashrc:
alias fakeroot="fakeroot -i $HOME/local/share/fakeroot/fakeroot.sav -s $HOME/local/share/fakeroot/fakeroot.sav"

and create the related directory:
mkdir -p ~/local/share/fakeroot
touch ~/local/share/fakeroot/fakeroot.sav

Then restart bash.
Attributes will be saved to fakeroot.sav when session exit, and will be loaded when session start.

Limitation:
Always use only single fakeroot instance in one time.