summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-02-15 08:32:15 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-02-15 08:32:15 +0000
commit85361796beb7477609d6903a27b6da6f06081418 (patch)
tree02019e1902369fb0a3be51e971e08891a608f933
parent8d01aa4ca33ff7e0ffc44d473ac99e61e195d86a (diff)
make_static_devs: a script to generate the static device files.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8033 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rwxr-xr-xbuild_tools/make_static_devs67
1 files changed, 67 insertions, 0 deletions
diff --git a/build_tools/make_static_devs b/build_tools/make_static_devs
new file mode 100755
index 0000000..2c19de6
--- /dev/null
+++ b/build_tools/make_static_devs
@@ -0,0 +1,67 @@
+#!/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
+