#!/usr/bin/sh -e

# See check_sane_mount from debootstrap (in /usr/share/debootstrap/functions).

if [ -z "$1" ]; then
    echo "Usage: $0 dir"
    exit 1
fi

if ! sudo mknod "$1/test-dev-null" c 1 3 -m 666 || ! echo test > "$1/test-dev-null"; then
    rm -f "$1/test-dev-null"
    exit 1
fi
rm -f "$1/test-dev-null"
