#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/route - configuration of additional routes # # Creation: 2001-10-15 fm # Last Update: $Id: route,v 1.1 2007-05-19 19:50:13 jv Exp $ # # Copyright (c) 2001-2007 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- set -e if [ -f /lib/lsb/init-functions ] then . /lib/lsb/init-functions else log_action_begin_msg () { echo -n "$@... " } log_action_end_msg () { if [ "$1" -eq 0 ]; then echo done. else echo failed. fi } fi case "$1" in stop) # route isn't a daemon ;; start|restart) log_action_begin_msg "Setting up additional routes" . /etc/config.d/base if [ "$ROUTE_DO_DEBUG" = yes ] then set -x fi idx=1 while [ "$idx" -le "$IP_ROUTE_N" ] do eval route='$IP_ROUTE_'${idx} set ${route} net="$1" netmask="$2" gw="$3" route add -net ${net} netmask ${netmask} gw ${gw} idx=`/usr/bin/expr ${idx} + 1` done set +x log_action_end_msg 0 ;; *) log_action_msg 'Usage: /etc/init.d/route {start|restart|stop}' exit 1 ;; esac