# echo ezchroot $IMGFILE $CHROOT $*
+# Strip off a trailing slash
+LASTCHAR=`echo $CHROOT | cut -c ${#CHROOT}`
+if [ "$LASTCHAR" = "/" ] ; then
+ echo "..stripping trailing slash..." >/dev/stderr
+ CHROOT=`echo $CHROOT | cut -c 0-$((${#CHROOT}-1))`
+fi
+
qmount $IMGFILE $CHROOT
MOUNTSUCCESS=$?
#Open e-mail attachments, etc
mount -o bind /var/tmp "$CHROOT/var/tmp"
+ #ArchLinux suggestions
+ mount -o bind /dev/shm "$CHROOT/dev/shm"
+ mount -o bind /sys "$CHROOT/sys"
+
#Any external devices
echo ... >/dev/stderr
MNTD=`cat /proc/mounts | grep ' /media/' | awk '{print $2}'`
#Make DBus work
mount -o bind /var/run/dbus "$CHROOT/var/run/dbus"
+ mount -o bind /var/lib/dbus "$CHROOT/var/lib/dbus"
+
+ #Make pulseaudio work
+ mount -o bind /var/run/pulse "$CHROOT/var/run/pulse"
#Speed hacks: lower the priority of processes
#renice 0 `pidof mmcqd`
- #renice 20 `pidof metalayer-crawler`
+ #renice 20 `pidof trackerd`
# Sync the chroot if requested...
if [ -f /home/user/.synchroot ] ; then
#Custom prompt and xterm title. Reduces confusion.
CHRLABEL=`blkid -s LABEL $IMGFILE | cut -d' ' -f2 | cut -d'=' -f2 | sed 's/"//g'`
+
+#If the file is mounted on loop, use that label.
+if [ "x$CHRLABEL" = "x" ] ; then
+
+ # first find the loop
+ LOOPNO=`mount | grep loop | grep $CHROOT | awk '{print $1}'`
+
+ if [ "x$LOOPNO" != "x" ] ; then
+ CHRLABEL=`blkid -s LABEL $LOOPNO | cut -d' ' -f2 | cut -d'=' -f2 | sed 's/"//g'`
+ fi
+fi
+
if [ "x$CHRLABEL" = "x" ] ; then
CHRLABEL=chroot
fi
+
echo -ne "\033]0;$CHRLABEL\007" >/dev/stderr
export PS1="[\u@$CHRLABEL: \w]"