| 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 | set -u
|
|---|
| 11 |
|
|---|
| 12 | case $(basename $0) in
|
|---|
| 13 | ifup)
|
|---|
| 14 | ;;
|
|---|
| 15 | ifdown)
|
|---|
| 16 | ;;
|
|---|
| 17 | *)
|
|---|
| 18 | echo "Usage: ifup|ifdown [options]"
|
|---|
| 19 | echo "For options see man busybox"
|
|---|
| 20 | exit 1
|
|---|
| 21 | ;;
|
|---|
| 22 | esac
|
|---|
| 23 |
|
|---|
| 24 | CFG_BUSYBOX_COMPAT=0
|
|---|
| 25 |
|
|---|
| 26 | if [ -f /etc/conf.d/ifupdown ]
|
|---|
| 27 | then
|
|---|
| 28 | . /etc/conf.d/ifupdown
|
|---|
| 29 | else
|
|---|
| 30 | CFG_BUSYBOX_COMPAT=1
|
|---|
| 31 | fi
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | if [ "$CFG_BUSYBOX_COMPAT" = "1" ]
|
|---|
| 35 | then
|
|---|
| 36 | busybox $(basename $0) $@
|
|---|
| 37 | else
|
|---|
| 38 | # cleanup hook dirs, or should we patch busybox ???
|
|---|
| 39 | for dir in pre-up up down post-down
|
|---|
| 40 | do
|
|---|
| 41 | mount --bind /opt/ifupdown/hook /etc/network/if-${dir}.d
|
|---|
| 42 | done
|
|---|
| 43 |
|
|---|
| 44 | eval IFUPDOWN_ENV="" $(cat /etc/conf.d/ifupdown | sed "s/#.*//g" ) \
|
|---|
| 45 | busybox $(basename $0) $@ 2>&1 | sed '/^run-parts:/d'
|
|---|
| 46 |
|
|---|
| 47 | # restore hook dirs
|
|---|
| 48 | for dir in pre-up up down post-down
|
|---|
| 49 | do
|
|---|
| 50 | umount /etc/network/if-${dir}.d
|
|---|
| 51 | done
|
|---|
| 52 | fi
|
|---|
| 53 |
|
|---|
| 54 | # vim:ts=4
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.