Here's a better for the nstxd init.d script. This approach does not work for nstxcd:
Starting nstxcd: + start-stop-daemon --start -b -m --quiet --pidfile /var/run/nstxcd.pid --exec /usr/sbin/nstxcd -- r0adw.madduck.net 192.168.14.1 + sleep 1 + command -v ip + [ -x /sbin/ip ] + ip link set sit0 name nstxcd SIOCSIFNAME: Device or resource busy --- /tmp/nstxd 2005-04-29 11:10:02.000000000 +0200 +++ /etc/init.d/nstxd 2006-11-13 14:29:23.000000000 +0100 @@ -26,6 +26,15 @@ fi } +rename_tun_iface() { + local IF_OLD + IF_OLD="$(sed -rne '$s,^[[:space:]]+(tun[[:alnum:]]+):.*,\1,p' /proc/net/dev)" + [ -z "$IF_OLD" ] && return 1 + [ -z "$1" ] && echo $IF_OLD && return 2 + [ ! -x "$(command -v ip 2>/dev/null)" ] && echo $IF_OLD && return 3 + ip link set $IF_OLD name $1 + echo $1 +} case "$1" in start) @@ -34,8 +43,12 @@ start-stop-daemon --start -b -m --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $NSTX_OPTIONS $NSTX_DOMAIN sleep 1; + + [ -n "$IF_TUN" ] && ip link set $IF_TUN name $IF + IF="$(rename_tun_iface nstxd)" if [ "$ifup_tun0" = "yes" ]; then - ifup tun0 + echo "$IF" > /var/run/$NAME.iface + ifup "$IF" fi echo "$NAME." else @@ -45,7 +58,9 @@ stop) echo -n "Stopping $DESC: " if [ "$ifup_tun0" = "yes" ]; then - ifdown tun0 + [ -r /var/run/$NAME.iface ] && read IF < /var/run/$NAME.iface + ifdown "${IF:-tun0}" + rm -f /var/run/$NAME.iface fi start-stop-daemon --stop --quiet -m -o --pidfile /var/run/$NAME.pid \ --exec $DAEMON @@ -58,8 +73,9 @@ # just the same as "restart". # echo -n "Restarting $DESC: " + [ -r /var/run/$NAME.iface ] && read IF < /var/run/$NAME.iface if [ "$ifup_tun0" = "yes" ]; then - ifdown tun0 + ifdown "${IF:-tun0}" fi start-stop-daemon --stop -m -o --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON @@ -69,11 +85,12 @@ /var/run/$NAME.pid --exec $DAEMON -- $NSTX_OPTIONS $NSTX_DOMAIN sleep 1; if [ "$ifup_tun0" = "yes" ]; then - ifup tun0 + ifup "${IF:-tun0}" fi echo "$NAME." else RET=1 + rm -f /var/run/$NAME.iface fi ;; *) -- .''`. martin f. krafft <[EMAIL PROTECTED]> : :' : proud Debian developer, author, administrator, and user `. `'` http://people.debian.org/~madduck - http://debiansystem.info `- Debian - when you have better things to do than fixing systems
signature.asc
Description: Digital signature (GPG/PGP)