Created
September 16, 2015 14:16
-
-
Save cfra/25fd85464e2d574499e3 to your computer and use it in GitHub Desktop.
Wrapper script around chroot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if [ x"$1" = x"" -o ! -d "/var/chroot/$1" ]; then | |
echo "Usage: $0 <chroot>" >&2 | |
exit 1 | |
fi | |
cd /var/chroot/$1 | |
mount -t devtmpfs devtmpfs dev | |
mount -t proc proc proc | |
mount -t sysfs sysfs sys | |
rm -f root/.Xauthority | |
touch root/.Xauthority | |
xauth -f root/.Xauthority add $(xauth list | head -n 1) | |
chroot . /usr/bin/env -i TERM="$TERM" HOME="/root" DISPLAY="$DISPLAY" XAUTHORITY="/root/.Xauthority" debian_chroot="chroot-$1" /bin/bash -l | |
umount -l dev | |
umount -l proc | |
umount -l sys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment