General TC > Programming & Scripting - Unofficial

capturing installed files with chroot and unionfs-fuse - test me!


So, today I was messing around with the concept of sandboxing a running instance of Tiny Core inside of a chroot for remastering purposes - I think this subforum would probably get the most use out of what I learned because I think it would be great for building extensions. It took me a few tries but I eventually did get it to work.

If this does work as it appears to, it seems to me that it would be a superior method of creating extensions compared to the touch mark / find newer method, or messing around with prefix variables that makefiles may or may not even respect in the first place.

Basically, what I did was, I booted a base tinycore (base boot option - so technically i guess it was a microcore), installed fuse and unionfs-fuse, created a union of a read-only copy of the root directory with a temp directory on top to capture changes with copy-on-write, and chroot'd into it. This is basically what happens with most live CD distro's... but it allows you to
--- Code: newbielink:javascript:void(0); [nonactive] ---make install
--- End code ---
something onto your current running system inside of the chroot and capture all changes into a temporary directory.

For my purposes, I was wanting to
--- Code: newbielink:javascript:void(0); [nonactive] ---tce-install
--- End code ---
some stuff and re-compress into a separate cpio.gz to load on boot. Here's the process, it's actually pretty straightforward:

The only non TC thing you need to grab is fuse-unionfs, because it's not an extension currently.

If you get it in RPM form you can just do
--- Code: newbielink:javascript:void(0); [nonactive] ---sudo rpm -i fuse-unionfs-0.25-1.el6.rf.i686.rpm
--- End code ---

everything else is done in TC:

--- Code: newbielink:javascript:void(0); [nonactive] ---tce-load -iw fuse.tcz
sudo su
mkdir /tmp/root-cow
mkdir /mnt/union
unionfs -o allow_other,use_ino,suid,dev,nonempty -ocow /tmp/root-cow=RW:/=RO /mnt/union
cd /mnt/union
chroot .
su tc

--- End code ---

And that's about it. Any changes performed in that shell will go into the /tmp/root-cow directory.

So you could compile everything, test it out and what not, then just chroot and do a make install  8)

This method just needs to be tested to make sure that the results are what would be expected - for now, I'm just putting it out there.

Enjoy :)



[0] Message Index

Go to full version