#!/bin/bash
#
# bind-mount /proc, /sys and /dev
#
mountpoint=${1:-/mnt}
# usage
#
if [ "$1" = "" -o "$1" = "--help" ] ; then
echo "Usage: $(basename $0) <mountpoint (default=/mnt)>"
exit 0
fi
# bind-mount proc sys and dev
#
for fs in proc sys dev ; do
mkdir -p $mountpoint/$fs
mount --bind /$fs $mountpoint/$fs
done
if [ -d $mountpoint/run ]; then
mkdir $mountpoint/run/lock
fi