| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # This file is part of the FreeWRT project. FreeWRT is copyrighted
|
|---|
| 4 | # material, please see the LICENCE file in the top-level directory
|
|---|
| 5 | # or at http://www.freewrt.org/licence for details.
|
|---|
| 6 | #
|
|---|
| 7 | # Christian Fischer <spaetzle@freewrt.org>
|
|---|
| 8 | #
|
|---|
| 9 |
|
|---|
| 10 | case $(basename $0) in
|
|---|
| 11 | ifup)
|
|---|
| 12 | ;;
|
|---|
| 13 | ifdown)
|
|---|
| 14 | ;;
|
|---|
| 15 | *)
|
|---|
| 16 | echo "Usage: ifup|ifdown [options]"
|
|---|
| 17 | echo "For options see man busybox"
|
|---|
| 18 | exit 1
|
|---|
| 19 | ;;
|
|---|
| 20 | esac
|
|---|
| 21 |
|
|---|
| 22 | if [ -f /etc/conf.d/ifupdown ]
|
|---|
| 23 | then
|
|---|
| 24 | . /etc/conf.d/ifupdown
|
|---|
| 25 | else
|
|---|
| 26 | CFG_BUSYBOX_COMPAT=1
|
|---|
| 27 | fi
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | if [ "$CFG_BUSYBOX_COMPAT" = "1" ]
|
|---|
| 31 | then
|
|---|
| 32 | busybox $(basename $0) $@
|
|---|
| 33 | else
|
|---|
| 34 | # cleanup hook dirs, or should we patch busybox ???
|
|---|
| 35 | for dir in pre-up up down post-down
|
|---|
| 36 | do
|
|---|
| 37 | mount --bind /opt/ifupdown/hook /etc/network/if-${dir}.d
|
|---|
| 38 | done
|
|---|
| 39 |
|
|---|
| 40 | eval IFUPDOWN_ENV="" $(cat /etc/conf.d/ifupdown | sed "s/#.*//g" ) \
|
|---|
| 41 | busybox $(basename $0) $@ 2>&1 | sed '/^run-parts:/d'
|
|---|
| 42 |
|
|---|
| 43 | # restore hook dirs
|
|---|
| 44 | for dir in pre-up up down post-down
|
|---|
| 45 | do
|
|---|
| 46 | umount /etc/network/if-${dir}.d
|
|---|
| 47 | done
|
|---|
| 48 | fi
|
|---|
| 49 |
|
|---|
| 50 | # vim:ts=4
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.