Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate
1
#!/bin/sh
2
#
3
# Copyright (C) 2013 Daniel Francis <francis@sugarlabs.org>
4
#
5
# Based in qchroot
6
# by Alan M Bruce (qole) with help from Benson Mitchell and Thomas Perl
7
#
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
# MA 02110-1301, USA.
22
23
CHROOT=$1
24
25
# Devices
26
mount --bind /dev "$CHROOT/dev"
27
# Processes
28
mount --bind /proc "$CHROOT/proc"
29
30
#Gentoo wiki says this will make X work
31
mount --bind /dev/pts "$CHROOT/dev/pts"
32
mount --bind /tmp "$CHROOT/tmp"
33
34
#Open e-mail attachments, etc
35
mount --bind /var/tmp "$CHROOT/var/tmp"
36
37
#ArchLinux suggestions
38
mount --bind /dev/shm "$CHROOT/dev/shm"
39
mount --bind /sys "$CHROOT/sys"
40
41
#Make DBus work
42
mount --bind /var/run/dbus "$CHROOT/var/run/dbus"
43
mount --bind /var/lib/dbus "$CHROOT/var/lib/dbus"
44
45
#Make pulseaudio work
46
mount -o bind /var/run/pulse "$CHROOT/var/run/pulse"
47
48
xhost + > /dev/null
49
50
# Now chroot
51
chroot $@
52
53
# Unmount all directories
54
55
umount "$CHROOT/proc"
56
57
umount "$CHROOT/dev/pts"
58
umount "$CHROOT/tmp"
59
60
umount "$CHROOT/var/tmp"
61
62
umount "$CHROOT/dev/shm"
63
umount "$CHROOT/sys"
64
65
umount "$CHROOT/var/run/dbus"
66
umount "$CHROOT/var/lib/dbus"
67
68
umount "$CHROOT/var/run/pulse"
69
70
umount "$CHROOT/dev"