Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
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. So: 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 Callbacks: 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: new_image.sh This one is run every time a new cache file was created. It is not run if you're just remounting an existing cache. new_mirror.sh 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 new_image.sh 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 new_mirror.sh to make sure some state is removed so that the mirror is independent from the host.