1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/sh
# This script is called by ifup/down to load the network scheme specified by
# ifscheme.
#
# Arguments : on the command line, we have the name of the interface.
# If the mapping contains some "map" statements, we get them from stdin.
SCHEME=/etc/network/run/scheme
# Take care of users calling this program directly.
if [ -z "$1" ] ; then
prog=$(basename $0)
echo "$prog: This script is a utility for ifscheme." >&2
echo "$prog: See the ifscheme(1) man page for more information." >&2
exit 1
fi
# Figure out what the mapping should be
iface="$1"
mapping=""
if [ ! -e $SCHEME ]; then
mapping="$iface"
else
mapping="$iface-$(cat $SCHEME)"
fi
# Look at map statements passed by ifup for special cases
while read glob scheme; do
# test if match globbing pattern (i.e. match '*' properly)
case "$mapping" in
$glob)
mapping="$scheme"
break
;;
esac
done
# Return to ifup
echo $mapping
|