debian/masqmail-debian

annotate masqmail.ip-up @ 55:22f2c10c83b5

improved the copyright file added the licenses of contributed code this should have been done much earlier upstream did also switch to better suited licensed contributed code
author meillo@marmaro.de
date Mon, 19 Jul 2010 12:24:02 +0200
parents
children
rev   line source
meillo@0 1 #!/bin/sh
meillo@0 2
meillo@0 3 # Exit if package was removed but not purged.
meillo@0 4 test -x /usr/sbin/masqmail || exit 0
meillo@0 5
meillo@0 6 # defaults, do not edit here but in
meillo@0 7 # /etc/default/masqmail
meillo@0 8 IPUP_RUNQUEUE=true
meillo@0 9 IPUP_FETCH=true
meillo@0 10
meillo@0 11 [ -r /etc/default/masqmail ] && . /etc/default/masqmail
meillo@0 12
meillo@0 13 if [ -n "$PPP_IFACE" ]; then
meillo@0 14 SCHEME="$PPP_IPPARAM"
meillo@0 15 IFACE=$PPP_IFACE
meillo@0 16 else
meillo@0 17 SCHEME="${IF_MROUTE:-$IF_NAME}"
meillo@0 18 fi
meillo@0 19
meillo@0 20 if [ ! x"$IFUP_IFACES" = x"all" ] ; then
meillo@0 21 echo $IFUP_IFACES | grep $IFACE > /dev/null || exit 0
meillo@0 22 fi
meillo@0 23
meillo@0 24 DETECT="`awk -F'[ \t]*=[ \t]*' '/^online_detect/ \
meillo@0 25 { print split($2,A,\"\\\"\") == 3 ? A[2] : $2 }' /etc/masqmail/masqmail.conf`"
meillo@0 26
meillo@0 27 if [ x"$DETECT" = x"file" ] ; then
meillo@0 28 ROUTEFILE="`awk -F'[ \t]*=[ \t]*' '/^online_file/ \
meillo@0 29 { print split($2,A,\"\\\"\") == 3 ? A[2] : $2 }' /etc/masqmail/masqmail.conf`"
meillo@0 30
meillo@0 31 if [ -z "$ROUTEFILE" ]; then
meillo@0 32 echo "no online_file defined in /etc/masqmail/masqmail.conf"
meillo@0 33 exit 1
meillo@0 34 fi
meillo@0 35 fi
meillo@0 36
meillo@0 37 if [ -z "$MODE" ]; then
meillo@0 38 case `dirname "$0"` in
meillo@0 39 */if-up.d|*/ip-up.d)
meillo@0 40 MODE=start;
meillo@0 41 ;;
meillo@0 42 */if-down.d|*/ip-down.d)
meillo@0 43 MODE=stop;
meillo@0 44 ;;
meillo@0 45 esac
meillo@0 46 fi
meillo@0 47
meillo@0 48 case "$MODE" in
meillo@0 49 start)
meillo@0 50 if [ -n "$SCHEME" ] ; then
meillo@0 51 echo -n "$SCHEME" > "$ROUTEFILE"
meillo@0 52 chmod 0644 "$ROUTEFILE"
meillo@0 53 else
meillo@0 54 echo -n "$PPP_IFACE" > "$ROUTEFILE"
meillo@0 55 chmod 0644 "$ROUTEFILE"
meillo@0 56 fi
meillo@0 57 if [ x"$IPUP_RUNQUEUE" = x"true" ] ; then
meillo@0 58 /usr/sbin/masqmail -qo &
meillo@0 59 fi
meillo@0 60 if [ x"$IPUP_FETCH" = x"true" ] ; then
meillo@0 61 /usr/sbin/masqmail -go &
meillo@0 62 fi
meillo@0 63 ;;
meillo@0 64 stop)
meillo@0 65 rm -f "$ROUTEFILE"
meillo@0 66 ;;
meillo@0 67 *)
meillo@0 68 echo "$0: unknown MODE"
meillo@0 69 ;;
meillo@0 70 esac
meillo@0 71
meillo@0 72 exit 0
meillo@0 73
meillo@0 74