From 08409051bea263523a0883b2fc3167d1da3612b4 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 29 Dec 2009 01:04:10 +0100 Subject: add atm network script order network scripts. Add atm example. enable reboot option for mtd. --- .../extra/etc/network/if-post-down.d/01-bridge | 24 ++++++++++++ .../extra/etc/network/if-post-down.d/bridge | 24 ------------ .../extra/etc/network/if-pre-up.d/01-atm | 43 ++++++++++++++++++++++ .../extra/etc/network/if-pre-up.d/02-bridge | 32 ++++++++++++++++ .../extra/etc/network/if-pre-up.d/bridge | 32 ---------------- package/mpd/files/mpd.conf | 14 +++++++ package/mtd/src/mtd.c | 20 ++++++++-- package/ppp/files/ppp.pre-up | 2 +- 8 files changed, 130 insertions(+), 61 deletions(-) create mode 100755 package/base-files/extra/etc/network/if-post-down.d/01-bridge delete mode 100755 package/base-files/extra/etc/network/if-post-down.d/bridge create mode 100644 package/base-files/extra/etc/network/if-pre-up.d/01-atm create mode 100755 package/base-files/extra/etc/network/if-pre-up.d/02-bridge delete mode 100755 package/base-files/extra/etc/network/if-pre-up.d/bridge (limited to 'package') diff --git a/package/base-files/extra/etc/network/if-post-down.d/01-bridge b/package/base-files/extra/etc/network/if-post-down.d/01-bridge new file mode 100755 index 000000000..eda1fe3bf --- /dev/null +++ b/package/base-files/extra/etc/network/if-post-down.d/01-bridge @@ -0,0 +1,24 @@ +#!/bin/sh + +if [ ! -x /usr/sbin/brctl ] +then + exit 0 +fi + +case "$IF_BRIDGE_PORTS" in + "") + exit 0 + ;; + none) + INTERFACES="" + ;; + *) + INTERFACES="$IF_BRIDGE_PORTS" + ;; +esac + +for IF in $INTERFACES; do + ip link set down dev $IF && brctl delif $IFACE $IF +done + +ip link set down dev $IFACE || exit 1 diff --git a/package/base-files/extra/etc/network/if-post-down.d/bridge b/package/base-files/extra/etc/network/if-post-down.d/bridge deleted file mode 100755 index eda1fe3bf..000000000 --- a/package/base-files/extra/etc/network/if-post-down.d/bridge +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -if [ ! -x /usr/sbin/brctl ] -then - exit 0 -fi - -case "$IF_BRIDGE_PORTS" in - "") - exit 0 - ;; - none) - INTERFACES="" - ;; - *) - INTERFACES="$IF_BRIDGE_PORTS" - ;; -esac - -for IF in $INTERFACES; do - ip link set down dev $IF && brctl delif $IFACE $IF -done - -ip link set down dev $IFACE || exit 1 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/01-atm b/package/base-files/extra/etc/network/if-pre-up.d/01-atm new file mode 100644 index 000000000..08baf73c7 --- /dev/null +++ b/package/base-files/extra/etc/network/if-pre-up.d/01-atm @@ -0,0 +1,43 @@ +#!/bin/sh + +if [ ! -x /usr/sbin/br2684ctl ] +then + exit 0 +fi + +[ "$METHOD" == "atm" ] || exit 0 + +[ "$IF_ATM_ENCAPS" ] || encap=0 +[ "$IF_ATM_PAYLOAD" ] || payload=1 +[ "$IF_ATM_VPI" ] || $IF_ATM_VPI=1 +[ "$IF_ATM_VCI" ] || $IF_ATM_VCI=32 + +case "$IF_ATM_PAYLOAD" in +bridged) + payload=1 + ;; +routed) + payload=0 + ;; +*) + echo "Wrong payload, use either bridged or routed" + exit 1 + ;; +esac + +case "$IF_ATM_ENCAPS" in +llc) + encap=0 + ;; +vc) + encap=1 + ;; +*) + echo "Wrong Encapsulation use either llc or vc" + exit 1 + ;; +esac + +br2684ctl -b -c 0 -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI +ifconfig nas0 up +exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/02-bridge b/package/base-files/extra/etc/network/if-pre-up.d/02-bridge new file mode 100755 index 000000000..766084de1 --- /dev/null +++ b/package/base-files/extra/etc/network/if-pre-up.d/02-bridge @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ ! -x /usr/sbin/brctl ] +then + exit 0 +fi + +case "$IF_BRIDGE_PORTS" in + "") + exit 0 + ;; + none) + INTERFACES="" + ;; + *) + INTERFACES="$IF_BRIDGE_PORTS" + ;; +esac + +brctl addbr $IFACE || exit 1 + +for IF in $INTERFACES; do + if ! grep -q $IF /proc/net/dev; then + echo "Error: interface '$IF' does not exist!" + brctl delbr $IFACE + exit 1 + fi + brctl addif $IFACE $IF + ip link set up dev $IF +done + +exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/bridge b/package/base-files/extra/etc/network/if-pre-up.d/bridge deleted file mode 100755 index 766084de1..000000000 --- a/package/base-files/extra/etc/network/if-pre-up.d/bridge +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -if [ ! -x /usr/sbin/brctl ] -then - exit 0 -fi - -case "$IF_BRIDGE_PORTS" in - "") - exit 0 - ;; - none) - INTERFACES="" - ;; - *) - INTERFACES="$IF_BRIDGE_PORTS" - ;; -esac - -brctl addbr $IFACE || exit 1 - -for IF in $INTERFACES; do - if ! grep -q $IF /proc/net/dev; then - echo "Error: interface '$IF' does not exist!" - brctl delbr $IFACE - exit 1 - fi - brctl addif $IFACE $IF - ip link set up dev $IF -done - -exit 0 diff --git a/package/mpd/files/mpd.conf b/package/mpd/files/mpd.conf index 6c23d582d..6e5309e86 100644 --- a/package/mpd/files/mpd.conf +++ b/package/mpd/files/mpd.conf @@ -15,3 +15,17 @@ audio_output { } # Volume control mixer mixer_type "alsa" + +# shout example +#audio_output { +# type "shout" +# name "personal mpd stream" +# host "127.0.0.1" +# port "8000" +# mount "/mpd" +# quality "5.0" +# format "44100:16:2" +# user "source" +# password "musicrockz" +#} + diff --git a/package/mtd/src/mtd.c b/package/mtd/src/mtd.c index 6812c5e31..1230688b1 100644 --- a/package/mtd/src/mtd.c +++ b/package/mtd/src/mtd.c @@ -43,6 +43,7 @@ #include #include +#include #define BUFSIZE (16 * 1024) #define MAX_ARGS 8 @@ -253,15 +254,16 @@ usage(void) " -q quiet mode (once: no [w] on writing,\n" " twice: no status messages)\n" " -e erase before executing the command\n\n" - "Example: To write linux.trx to mtd1 labeled as linux\n" - " mtd write linux.trx linux\n\n"); + " -r reboot after successful command\n" + "Example: To write linux.img to mtd partition labeled as linux\n" + " mtd write linux.img linux\n\n"); exit(1); } int main(int argc, char **argv) { - int ch, i, imagefd = -1, quiet, unlocked; + int ch, i, imagefd = -1, quiet, unlocked, boot; char *erase[MAX_ARGS], *device; const char *imagefile = NULL; enum { @@ -271,6 +273,7 @@ main(int argc, char **argv) } cmd; erase[0] = NULL; + boot = 0; buflen = 0; quiet = 0; @@ -282,6 +285,9 @@ main(int argc, char **argv) case 'q': quiet++; break; + case 'r': + boot = 1; + break; case 'e': i = 0; while ((erase[i] != NULL) && ((i + 1) < MAX_ARGS)) @@ -373,7 +379,13 @@ main(int argc, char **argv) fprintf(stderr, "\n"); break; } - + sync(); + if (boot) { + fprintf(stderr, "\nRebooting ... "); + fflush(stdout); + fflush(stderr); + syscall(SYS_reboot,LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,LINUX_REBOOT_CMD_RESTART,NULL); + } return 0; } diff --git a/package/ppp/files/ppp.pre-up b/package/ppp/files/ppp.pre-up index ec6cc5a31..c83a09177 100755 --- a/package/ppp/files/ppp.pre-up +++ b/package/ppp/files/ppp.pre-up @@ -36,7 +36,7 @@ sed "$REPLACE" < /etc/ppp/templates/$IF_USE_TEMPLATE > /etc/ppp/peers/$IF_PROVID [ "$IF_PPP_ENCAPS" ] || encap=0 [ "$IF_PPP_PAYLOAD" ] || payload=1 [ "$IF_PPP_VPI" ] || $IF_PPP_VPI=1 -[ "$IF_PPP_PAYLOAD" ] || $IF_PPP_VCI=32 +[ "$IF_PPP_VCI" ] || $IF_PPP_VCI=32 case "$IF_PPP_PAYLOAD" in bridged) -- cgit v1.2.3