etc-gentoo/init.d/gentoo32-stable

54 lines
2.3 KiB
Plaintext
Executable File

#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
need localmount
need bootmisc
}
CHROOTDIR=/mnt/root/root32-stable
start() {
ebegin "Mounting 32bits chroot dirs"
mount -o bind /dev "${CHROOTDIR}"/dev >/dev/null
mount -o bind /dev/pts "${CHROOTDIR}"/dev/pts >/dev/null &
mount -o bind /dev/shm "${CHROOTDIR}"/dev/shm >/dev/null &
mount -o bind /proc "${CHROOTDIR}"/proc >/dev/null
# mount -o bind /proc/bus/usb "${CHROOTDIR}"/proc/bus/usb >/dev/null &
mount -o bind /sys "${CHROOTDIR}"/sys >/dev/null &
mount -o bind /tmp "${CHROOTDIR}"/tmp >/dev/null &
mount -o bind /usr/portage "${CHROOTDIR}"/usr/portage/ >/dev/null &
mount -o bind /home/distfiles "${CHROOTDIR}"/distfiles >/dev/null &
mount -o bind /usr/local/portage "${CHROOTDIR}"/usr/local/portage/ >/dev/null &
mount -o bind /var/lib/layman "${CHROOTDIR}"/var/lib/layman >/dev/null &
eend $? "An error occured while attempting to mount 32bit chroot directories"
ebegin "Copying 32bits chroot files"
cp -pf /etc/exclude.depclean "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/resolv.conf "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/passwd "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/shadow "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/group "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/gshadow "${CHROOTDIR}"/etc >/dev/null &
cp -pf /etc/hosts "${CHROOTDIR}"/etc > /dev/null &
cp -Ppf /etc/localtime "${CHROOTDIR}"/etc >/dev/null &
eend $? "An error occured while attempting to copy 32 bits chroot files."
}
stop() {
ebegin "Unmounting 32bits chroot dirs"
umount -f "${CHROOTDIR}"/dev/pts >/dev/null
umount -f "${CHROOTDIR}"/dev/shm >/dev/null
umount -f "${CHROOTDIR}"/dev >/dev/null &
# umount -f "${CHROOTDIR}"/proc/bus/usb >/dev/null
umount -f "${CHROOTDIR}"/proc >/dev/null &
umount -f "${CHROOTDIR}"/sys >/dev/null &
umount -f "${CHROOTDIR}"/tmp >/dev/null &
umount -f "${CHROOTDIR}"/usr/portage >/dev/null &
umount -f "${CHROOTDIR}"/var/lib/layman >/dev/null &
umount -f "${CHROOTDIR}"/distfiles >/dev/null &
umount -f "${CHROOTDIR}"/usr/local/portage/ >/dev/null &
eend $? "An error occured while attempting to unmount 32bits chroot directories"
}