1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #!/bin/sh
- set -e
- # make_static_devs: create static device files for DAHDI
- # Copyright (C) 2010 by Xorcom <support@xorcom.com>
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- # In most cases DAHDI device files are generated by udev,
- # but there would be cases where you'd want to just have static device
- # files. Note that if you do use udev, that static device files will be
- # essentially deleted.
- BASE_DIR="/dev/dahdi"
- usage() {
- me=`basename $0`
- echo "$me: Generate static DAHDI device files"
- echo ""
- echo "Usage:"
- echo " $me [-h] [-d base_dir]"
- echo " -d base_dir: create under base_dir (default: $BASE_DIR)"
- echo " -h: this help message."
- }
- mknod_safe() {
- if [ -c $1 ]; then return; fi
- mknod "$@"
- }
- while getopts 'd:h' opt; do
- case "$opt" in
- h) usage; exit 0;;
- d) BASE_DIR="$OPTARG";;
- \?) usage; exit 1;;
- esac
- done
- mkdir -p "$BASE_DIR"
- mknod_safe "${BASE_DIR}/ctl" c 196 0
- mknod_safe "${BASE_DIR}/transcode" c 196 250
- mknod_safe "${BASE_DIR}/timer" c 196 253
- mknod_safe "${BASE_DIR}/channel" c 196 254
- mknod_safe "${BASE_DIR}/pseudo" c 196 255
- # The following are not used by Asterisk itself nowadays. Some DAHDI
- # users still find it simpler to open them directly rather than using
- # /dev/dahdi/channel and the DAHDI_SPECIFY ioctl .
- for i in `seq 249`; do
- mknod_safe ${BASE_DIR}/$i c 196 $i
- done
|