source: freewrt/package/fwifupdown/files/ifupdown.sh@ 655dec8

Last change on this file since 655dec8 was 8ebd04e, checked in by Christian Fischer <spaetzle@…>, 19 years ago

some fixes to get set -u working

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2390 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100755
File size: 1001 bytes
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
10set -u
11
12case $(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 ;;
22esac
23
24CFG_BUSYBOX_COMPAT=0
25
26if [ -f /etc/conf.d/ifupdown ]
27then
28 . /etc/conf.d/ifupdown
29else
30 CFG_BUSYBOX_COMPAT=1
31fi
32
33
34if [ "$CFG_BUSYBOX_COMPAT" = "1" ]
35then
36 busybox $(basename $0) $@
37else
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
52fi
53
54# vim:ts=4
Note: See TracBrowser for help on using the repository browser.