[dahdi-commits] tzafrir: branch tools/tzafrir/sysfs r8776 - /tools/team/tzafrir/sysfs/xpp/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Jun 14 18:34:46 CDT 2010
Author: tzafrir
Date: Mon Jun 14 18:34:42 2010
New Revision: 8776
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8776
Log:
safer symlink_span - create aliases before links
Modified:
tools/team/tzafrir/sysfs/xpp/symlink_span
Modified: tools/team/tzafrir/sysfs/xpp/symlink_span
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/symlink_span?view=diff&rev=8776&r1=8775&r2=8776
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/symlink_span (original)
+++ tools/team/tzafrir/sysfs/xpp/symlink_span Mon Jun 14 18:34:42 2010
@@ -33,7 +33,7 @@
set -e
-sysfs_attr_clean() {
+attr_clean() {
echo "$1" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/.-' '_'
}
@@ -64,6 +64,7 @@
SPAN_NAMES="/dev/dahdi/span-names"
SPAN_ALIASES="/dev/dahdi/span-aliases"
+DAHDI_ALIASES=${DAHDI_ALIASES:-/usr/sbin/dahdi_aliases}
REAL_SPAN_NUM=`echo $DEVPATH | sed 's/^.*-//'`
LINK_DEST="/dev/dahdi/spans/${REAL_SPAN_NUM}"
@@ -74,9 +75,9 @@
echo >&2 "$0($ACTION): Missing span_id attribute for '$DEVPATH'"
exit 1
fi
- SPAN_ID=`sysfs_attr_clean "$SPAN_ID"`
+ SPAN_ID=`attr_clean "$SPAN_ID"`
if [ "$HARDWARE_ID" != '' ]; then
- HARDWARE_ID=`sysfs_attr_clean "$HARDWARE_ID"`
+ HARDWARE_ID=`attr_clean "$HARDWARE_ID"`
LINK="${SPAN_NAMES}/${HARDWARE_ID}/$SPAN_ID"
#echo "ln -s '$LINK_DEST' '$LINK'" 1>&2
mkdir -p "${SPAN_NAMES}/${HARDWARE_ID}"
@@ -86,7 +87,7 @@
echo >&2 "$0($ACTION): Missing hardware_id attribute for '$DEVPATH'"
fi
if [ "$LOCATION" != '' ]; then
- LOCATION=`sysfs_attr_clean "$LOCATION"`
+ LOCATION=`attr_clean "$LOCATION"`
LINK="${SPAN_NAMES}/@${LOCATION}/$SPAN_ID"
#echo "ln -s '$LINK_DEST' '$LINK'" 1>&2
mkdir -p "${SPAN_NAMES}/@${LOCATION}"
@@ -107,15 +108,16 @@
case "$ACTION" in
add)
+ if [ ! -d "$SPAN_ALIASES" -a -x "$DAHDI_ALIASES" ]; then
+ "$DAHDI_ALIASES" create 2>&1 | $LOGGER
+ fi
create_links 2>&1 | $LOGGER
- if [ ! -d "$SPAN_ALIASES" ]; then
- "$dir/dahdi_aliases" create
- fi
;;
remove)
remove_links 2>&1 | $LOGGER
;;
online)
+ echo "Running dahdi_cfg on $REAL_SPAN_NUM" | $LOGGER
dahdi_cfg -c "$dahdiconfdir/system.conf" -S "$REAL_SPAN_NUM" -k 2>&1 | $LOGGER
( echo 1 > "/sys$DEVPATH/user_ready" ) 2>&1 | $LOGGER
;;
More information about the dahdi-commits
mailing list