blob: 87b67a1fb9696bce06c2a6f709c51e19966a8b54 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh
#
# Copyright (C) 2013 Daniel Francis <francis@sugarlabs.org>
#
# Based in qchroot
# by Alan M Bruce (qole) with help from Benson Mitchell and Thomas Perl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
CHROOT=$1
# Devices
mount --bind /dev "$CHROOT/dev"
# Processes
mount --bind /proc "$CHROOT/proc"
#Gentoo wiki says this will make X work
mount --bind /dev/pts "$CHROOT/dev/pts"
mount --bind /tmp "$CHROOT/tmp"
#Open e-mail attachments, etc
mount --bind /var/tmp "$CHROOT/var/tmp"
#ArchLinux suggestions
mount --bind /dev/shm "$CHROOT/dev/shm"
mount --bind /sys "$CHROOT/sys"
#Make DBus work
mount --bind /var/run/dbus "$CHROOT/var/run/dbus"
mount --bind /var/lib/dbus "$CHROOT/var/lib/dbus"
#Make pulseaudio work
mount -o bind /var/run/pulse "$CHROOT/var/run/pulse"
xhost + > /dev/null
# Now chroot
chroot $@
# Unmount all directories
umount "$CHROOT/proc"
umount "$CHROOT/dev/pts"
umount "$CHROOT/tmp"
umount "$CHROOT/var/tmp"
umount "$CHROOT/dev/shm"
umount "$CHROOT/sys"
umount "$CHROOT/var/run/dbus"
umount "$CHROOT/var/lib/dbus"
umount "$CHROOT/var/run/pulse"
umount "$CHROOT/dev"
|