From 47645160130837e007400a96684d729b87c5638e Mon Sep 17 00:00:00 2001 From: "Andreas K. Huettel (dilfridge)" Date: Sat, 16 Mar 2013 19:45:56 +0100 Subject: add rudimentary init script --- initscripts/chroot.x86 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 initscripts/chroot.x86 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" +} -- cgit v1.2.3-18-g5258