summaryrefslogtreecommitdiff
blob: 32863596850036b6acfdbfa382d62cd3285bc594 (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
#!/bin/sh

# TODO:
# - dbus?
# - init?

if [ -z "$@" ]; then
	echo "missing operand" >&2
	exit 1
fi

if [ ! -d "$@"/dev ]; then
	echo "no valid chroot environment" >&2
	exit 1
fi

mount --bind /dev "$@"/dev
mount --bind /dev/pts "$@"/dev/pts
mount --bind /sys "$@"/sys
mkdir -p "$@"/usr/portage
mount --bind /home/angelos/gentoo-x86 "$@"/usr/portage
mkdir -p "$@"/root/{packages,distfiles}
mount --bind /home/angelos/distfiles "$@"/root/distfiles
mount --bind /home/angelos/packages "$@"/root/packages
mount -t proc none "$@"/proc
cp /etc/resolv.conf "$@"/etc

if [ -x "$@${SHELL}" ]; then
	exe=${SHELL}
else
	exe=/bin/bash
fi

chroot "$@" ${exe}