debian/masqmail-debian

diff masqmail.ip-up @ 0:5ef519035828

debian directory of masqmail-0.2.21-4
author meillo@marmaro.de
date Fri, 26 Sep 2008 21:25:48 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/masqmail.ip-up	Fri Sep 26 21:25:48 2008 +0200
     1.3 @@ -0,0 +1,74 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Exit if package was removed but not purged.
     1.7 +test -x /usr/sbin/masqmail || exit 0
     1.8 +
     1.9 +# defaults, do not edit here but in
    1.10 +# /etc/default/masqmail
    1.11 +IPUP_RUNQUEUE=true
    1.12 +IPUP_FETCH=true
    1.13 +
    1.14 +[ -r /etc/default/masqmail ] && . /etc/default/masqmail
    1.15 +
    1.16 +if [ -n "$PPP_IFACE" ]; then
    1.17 +	SCHEME="$PPP_IPPARAM"
    1.18 +	IFACE=$PPP_IFACE
    1.19 +else
    1.20 +	SCHEME="${IF_MROUTE:-$IF_NAME}"
    1.21 +fi
    1.22 +
    1.23 +if [ ! x"$IFUP_IFACES" = x"all" ] ; then
    1.24 +  echo $IFUP_IFACES | grep $IFACE > /dev/null || exit 0
    1.25 +fi
    1.26 +
    1.27 +DETECT="`awk -F'[ \t]*=[ \t]*' '/^online_detect/ \
    1.28 +	{ print split($2,A,\"\\\"\") == 3 ? A[2] :  $2 }' /etc/masqmail/masqmail.conf`"
    1.29 +
    1.30 +if [ x"$DETECT" = x"file" ] ; then
    1.31 +    ROUTEFILE="`awk -F'[ \t]*=[ \t]*' '/^online_file/ \
    1.32 +	    { print split($2,A,\"\\\"\") == 3 ? A[2] :  $2 }' /etc/masqmail/masqmail.conf`"
    1.33 +
    1.34 +    if [ -z "$ROUTEFILE" ]; then
    1.35 +	    echo "no online_file defined in /etc/masqmail/masqmail.conf"
    1.36 +	    exit 1
    1.37 +    fi
    1.38 +fi
    1.39 +
    1.40 +if [ -z "$MODE" ]; then
    1.41 +	case `dirname "$0"` in
    1.42 +		*/if-up.d|*/ip-up.d)
    1.43 +		    MODE=start;
    1.44 +		    ;;
    1.45 +		*/if-down.d|*/ip-down.d)
    1.46 +		    MODE=stop;
    1.47 +		    ;;
    1.48 +	esac
    1.49 +fi
    1.50 +
    1.51 +case "$MODE" in
    1.52 +	start)
    1.53 +		if [ -n "$SCHEME" ] ; then
    1.54 +		    echo -n "$SCHEME" > "$ROUTEFILE"
    1.55 +		    chmod 0644 "$ROUTEFILE"
    1.56 +		else
    1.57 +		    echo -n "$PPP_IFACE" > "$ROUTEFILE"
    1.58 +		    chmod 0644 "$ROUTEFILE"
    1.59 +		fi
    1.60 +		if [ x"$IPUP_RUNQUEUE" = x"true" ] ; then
    1.61 +		    /usr/sbin/masqmail -qo &
    1.62 +		fi
    1.63 +		if [ x"$IPUP_FETCH" = x"true" ] ; then
    1.64 +		    /usr/sbin/masqmail -go &
    1.65 +		fi
    1.66 +		;;
    1.67 +	stop)
    1.68 +		rm -f "$ROUTEFILE"
    1.69 +		;;
    1.70 +	*)
    1.71 +		echo "$0: unknown MODE"
    1.72 +		;;
    1.73 +esac
    1.74 +
    1.75 +exit 0
    1.76 +
    1.77 +