summaryrefslogtreecommitdiff
blob: fa024f5c67d7728e05f5b0217559ed8ba6e3e9b3 (plain)
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
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

CHROOT_LOCATION=${CHROOT_LOCATION:-/opt/x86-chroot}

depend() {
	need localmount
	need bootmisc
}

start() {
	ebegin "Mounting 32bits chroot dirs to ${CHROOT_LOCATION}"
	for loc in /dev /dev/pts /dev/shm /proc /proc/bus/usb /sys /tmp ; do
	    mount -o bind ${loc} ${CHROOT_LOCATION}${loc} >/dev/null
	done
	eval "$(portageq envvar -v PORTDIR DISTDIR)"
	[[ -d ${PORTDIR}/distfiles ]] || mkdir ${PORTDIR}/distfiles
	mount -o bind ${PORTDIR} ${CHROOT_LOCATION}/usr/portage >/dev/null
	mount -o bind ${DISTDIR} ${CHROOT_LOCATION}/usr/portage/distfiles >/dev/null
	eend $? "An error occured while attempting to mount 32bit chroot directories"

	ebegin "Copying 32bits chroot files"
	for conffile in resolv.conf passwd shadow group gshadow hosts ; do
		[[ -f /etc/${conffile} ]] && cp -pf /etc/${conffile} ${CHROOT_LOCATION}/etc >/dev/null &
	done
	cp -Ppf /etc/localtime ${CHROOT_LOCATION}/etc >/dev/null &
	eend $? "An error occured while attempting to copy 32 bits chroot files."
}

stop() {
	ebegin "Unmounting 32bits chroot dirs"
	for loc in /dev/pts /dev/shm /dev /proc/bus/usb /proc /sys /tmp /usr/portage/distfiles /usr/portage; do
		umount -f ${CHROOT_LOCATION}${loc} >/dev/null
	done
	eend $? "An error occured while attempting to unmount 32bits chroot directories"
}