#!/bin/bash # Rename this to the dir where you have stored your debootstrap CHROOT_DIR="/opt/debootstrap/d10i386" mount_if_needed() { local mount_point=$1 local mount_cmd=$2 if ! mount | grep -q "on $mount_point "; then echo "Mounting $mount_point..." eval "$mount_cmd" else echo "$mount_point is already mounted." fi } mount_if_needed "$CHROOT_DIR/proc" "sudo mount --bind /proc $CHROOT_DIR/proc" mount_if_needed "$CHROOT_DIR/sys" "sudo mount --bind /sys $CHROOT_DIR/sys" mount_if_needed "$CHROOT_DIR/dev" "sudo mount --bind /dev $CHROOT_DIR/dev" mount_if_needed "$CHROOT_DIR/dev/pts" "sudo mount -t devpts devpts $CHROOT_DIR/dev/pts" # Uncomment this below only when you had created a "gameserv" user on the debootstrap. #sudo chroot "$CHROOT_DIR" /bin/su - gameserv # Comment this only when you had created a "gameserv" user on the chroot/debootstrap so you don't need to log in under root first. sudo chroot "$CHROOT_DIR"