aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Huettel (dilfridge) <mail@akhuettel.de>2013-03-16 19:45:56 +0100
committerAndreas K. Huettel (dilfridge) <mail@akhuettel.de>2013-03-16 19:45:56 +0100
commit47645160130837e007400a96684d729b87c5638e (patch)
tree340d51714d9e973c4c063c751e744411767588f8
parentAdd readme file (diff)
downloadlazychroot-master.tar.gz
lazychroot-master.tar.bz2
lazychroot-master.zip
add rudimentary init scriptHEADmaster
-rwxr-xr-xinitscripts/chroot.x8645
1 files changed, 45 insertions, 0 deletions
diff --git a/initscripts/chroot.x86 b/initscripts/chroot.x86
new file mode 100755
index 0000000..73b1ea3
--- /dev/null
+++ b/initscripts/chroot.x86
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+
+depend() {
+ need localmount
+ need bootmisc
+}
+
+start() {
+ ebegin "Mounting 32bits chroot dirs"
+ mount -o bind /dev /chroot/x86/dev >/dev/null
+ mount -o bind /dev/pts /chroot/x86/dev/pts >/dev/null
+ mount -o bind /dev/shm /chroot/x86/dev/shm >/dev/null
+ mount -o bind /proc /chroot/x86/proc >/dev/null
+ mount -o bind /proc/bus/usb /chroot/x86/proc/bus/usb >/dev/null
+ mount -o bind /sys /chroot/x86/sys >/dev/null
+ mount -o bind /tmp /chroot/x86/tmp >/dev/null
+ mount -o bind /usr/portage /chroot/x86/usr/portage/ >/dev/null
+ mount -o bind /usr/portage/distfiles /chroot/x86/usr/portage/distfiles/ >/dev/null
+ mount -o bind /usr/local/portage /chroot/x86/usr/local/portage/ >/dev/null
+ eend $? "An error occured while attempting to mount 32bit chroot directories"
+ ebegin "Copying 32bits chroot files"
+ cp -pf /etc/resolv.conf /chroot/x86/etc >/dev/null
+ cp -pf /etc/passwd /chroot/x86/etc >/dev/null
+ cp -pf /etc/shadow /chroot/x86/etc >/dev/null
+ cp -pf /etc/group /chroot/x86/etc >/dev/null
+ cp -pf /etc/gshadow /chroot/x86/etc >/dev/null
+ cp -pf /etc/hosts /chroot/x86/etc > /dev/null
+ cp -Ppf /etc/localtime /chroot/x86/etc >/dev/null
+ eend $? "An error occured while attempting to copy x86 chroot files."
+}
+
+stop() {
+ ebegin "Unmounting 32bits chroot dirs"
+ umount -f /chroot/x86/dev/pts >/dev/null
+ umount -f /chroot/x86/dev/shm >/dev/null
+ umount -f /chroot/x86/dev >/dev/null
+ umount -f /chroot/x86/proc/bus/usb >/dev/null
+ umount -f /chroot/x86/proc >/dev/null
+ umount -f /chroot/x86/sys >/dev/null
+ umount -f /chroot/x86/tmp >/dev/null
+ umount -f /chroot/x86/usr/portage/distfiles >/dev/null
+ umount -f /chroot/x86/usr/portage >/dev/null
+ umount -f /chroot/x86/usr/local/portage >/dev/null
+ eend $? "An error occured while attempting to unmount x86 chroot directories"
+}