#! /bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
TUNUSER=${TUNUSER:-uml}
TUNGROUP=${TUNGROUP:-uml}
TUNID=${TUNID:-$1} TUNID=${TUNID:-0}
exec 2>/dev/null
mknod /dev/net/tap$TUNID c 36 $[ $TUNID * 16 ] || exit $?
chown $TUNUSER:$TUNGROUP /dev/net/tap$TUNID || exit $?
ip l set up dev tap$TUNID || exit $?
exit 0