WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: capturing installed files with chroot and unionfs-fuse - test me!  (Read 4513 times)

Offline la11111

  • Newbie
  • *
  • Posts: 5
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: [Select]
make install 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: [Select]
tce-install 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: [Select]
sudo rpm -i fuse-unionfs-0.25-1.el6.rf.i686.rpm

everything else is done in TC:
Code: [Select]
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

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 :)

-la

Offline la11111

  • Newbie
  • *
  • Posts: 5
Re: capturing installed files with chroot and unionfs-fuse - test me!
« Reply #1 on: June 30, 2014, 01:50:48 PM »
hello all,

I'm bumping this because I've been gone awhile, and I got a question about an extension I maintained a couple of years ago. So, I thought I would brush up.

Since this post never got any replies (possibly because it's a little hard to follow, now that I read back on it), I was wondering, has anyone tried this method of creating extensions? If so, have you run into any problems?

For clarity, let me summarize the original post. This method of creating extensions transparently captures filesystem changes in a separate directory, which is useful when building extensions, as it eliminates the need to manually track down filesystem changes or modify makefiles.