#! /bin/sh # Startup script to create the device-mapper control device # on non-devfs systems. # Non-zero exit status indicates failure. export TEXTDOMAIN=slint . gettext.sh # These must correspond to the definitions in device-mapper.h and dm.h DM_DIR="mapper" DM_NAME="device-mapper" set -e DIR="/dev/$DM_DIR" CONTROL="$DIR/control" # Check for devfs, procfs if test -e /dev/.devfsd ; then gettext "devfs detected: devmap_mknod.sh script not required." echo exit fi if test ! -e /proc/devices ; then eval_gettext "procfs not found: please create \$CONTROL manually." echo exit 1 fi # Get major, minor, and mknod MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices) MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc) if test -z "$MAJOR" -o -z "$MINOR" ; then eval_gettext "\$DM_NAME kernel module not loaded: can't create \$CONTROL." exit 1 fi mkdir -p --mode=755 $DIR test -e $CONTROL && rm -f $CONTROL eval_gettext "Creating \$CONTROL character device with major:\$MAJOR minor:\$MINOR." echo mknod --mode=600 $CONTROL c $MAJOR $MINOR