Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 49 lines (37 sloc) 1.842 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
This is a few scripts to build a quick chroot mirror of your whole system.
It allows you to build up a mirror, enter into it, and then break it down.

They all need to be run as root.


sudo build_mirror test.img
This makes a file called test.img.
It mounts it to /mnt/easy_mirror/test/cache.
Then it makes a union between that and / at /mnt/easy_mirror/test/union.
If test.img already existed, then it's used as is.
Otherwise a new, empty, one is created.

sudo enter_mirror
This logs you in to the new image.
If you have more than one mounted at a time, then you'll need to specify.
sudo enter_mirror test

sudo breakdown_mirror
This attempts to cleanly unmount the mirror
It does not delete the image file (test.img).
If you have more than one mounted at a time, then you'll need to specify.
sudo breakdown_mirror test

I've got a system in place for scripts that you want to be run every time
a new mirror is setup.

The scripts are searched for in ~/.local/share/easy_mirror/
The '~' in this case is relative to the user who's running the scripts (Not root, even when under sudo)
Similarly, the scripts are run by that user, not root.

There are currently two:
This one is run every time a new cache file was created.
It is not run if you're just remounting an existing cache.
This one is run every time a new mirror is built, whether or not the image file is new.

Both of these scripts are run with the name of the mirror as the first argument.
If either of these scripts don't exist, or aren't executable, then they just won't be run.

I use for adding
export PS1="$MIRROR_NAME-$PS1"
to ~/.bashrc, so I can tell the mirrors apart from each other, and the root system.

I use to make sure some state is removed so that the mirror is independent from the host.
Something went wrong with that request. Please try again.