#!/bin/sh # # Copyright (C) 2013 Daniel Francis # # 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"