4 # Required-Start: ifupdown-clean
5 # Required-Stop: $local_fs
8 # Short-Description: Prepare the system for taking up interfaces.
11 [ -x /sbin/ifup ] || exit 0
12 [ -x /sbin/ifdown ] || exit 0
15 report() { echo "${MYNAME}: $*" ; }
16 report_err() { report "Error: $*" >&2 ; }
17 RUN_DIR=/etc/network/run
18 [ -r /etc/default/ifupdown ] && . /etc/default/ifupdown
20 # Note: The state file location is hardcoded in ifup|ifdown
21 IFSTATE=/etc/network/run/ifstate
27 while [ "$dest" != "" ]; do
28 if [ -d "$dest" ]; then
34 if [ -L "$dest" ]; then
35 d2=$(readlink "$dest")
36 if [ "${d2#/}" = "$d2" ]; then
43 while [ ! -e "$dest" ]; do
44 extras="${dest##*/}/$extras"
45 if [ "${extras%%/*}" = ".." ]; then return 1; fi
47 if [ "$destx" = "$dest" ]; then destx=""; fi
58 report_err "Arguments to '$1' command not accepted"
61 echo -n "Setting up networking..."
63 # if /etc/network/run is a symlink to a directory that doesn't exist,
66 if [ -L "$RUN_DIR" ] && [ ! -d "$RUN_DIR" ] ; then
67 runmkdir="$(myreadlink "$RUN_DIR")"
68 if [ ! "$runmkdir" ] ; then
70 report_err "Cannot create target of /etc/network/run"
73 if ! mkdir -p "$runmkdir"; then
75 report_err "Failure creating directory $runmkdir"
80 # Create the state file
81 # Doing this also signals that ifupdown is available for use
82 if [ ! -r "$IFSTATE" ]; then
83 if ! : > "$IFSTATE" ; then
85 report_err "Failure initializing $IFSTATE"
96 report_err "Arguments to '$1' command not accepted"
99 if [ -x /etc/init.d/ifupdown-clean ]; then
100 /etc/init.d/ifupdown-clean start
108 echo "Usage: $0 {start|stop|restart|force-reload}" >&2