debian/masqmail-debian

view masqmail.ip-up @ 27:792d5a6b7c7b

updated changelog
author meillo@marmaro.de
date Sun, 14 Jun 2009 11:43:15 +0200
parents
children
line source
1 #!/bin/sh
3 # Exit if package was removed but not purged.
4 test -x /usr/sbin/masqmail || exit 0
6 # defaults, do not edit here but in
7 # /etc/default/masqmail
8 IPUP_RUNQUEUE=true
9 IPUP_FETCH=true
11 [ -r /etc/default/masqmail ] && . /etc/default/masqmail
13 if [ -n "$PPP_IFACE" ]; then
14 SCHEME="$PPP_IPPARAM"
15 IFACE=$PPP_IFACE
16 else
17 SCHEME="${IF_MROUTE:-$IF_NAME}"
18 fi
20 if [ ! x"$IFUP_IFACES" = x"all" ] ; then
21 echo $IFUP_IFACES | grep $IFACE > /dev/null || exit 0
22 fi
24 DETECT="`awk -F'[ \t]*=[ \t]*' '/^online_detect/ \
25 { print split($2,A,\"\\\"\") == 3 ? A[2] : $2 }' /etc/masqmail/masqmail.conf`"
27 if [ x"$DETECT" = x"file" ] ; then
28 ROUTEFILE="`awk -F'[ \t]*=[ \t]*' '/^online_file/ \
29 { print split($2,A,\"\\\"\") == 3 ? A[2] : $2 }' /etc/masqmail/masqmail.conf`"
31 if [ -z "$ROUTEFILE" ]; then
32 echo "no online_file defined in /etc/masqmail/masqmail.conf"
33 exit 1
34 fi
35 fi
37 if [ -z "$MODE" ]; then
38 case `dirname "$0"` in
39 */if-up.d|*/ip-up.d)
40 MODE=start;
41 ;;
42 */if-down.d|*/ip-down.d)
43 MODE=stop;
44 ;;
45 esac
46 fi
48 case "$MODE" in
49 start)
50 if [ -n "$SCHEME" ] ; then
51 echo -n "$SCHEME" > "$ROUTEFILE"
52 chmod 0644 "$ROUTEFILE"
53 else
54 echo -n "$PPP_IFACE" > "$ROUTEFILE"
55 chmod 0644 "$ROUTEFILE"
56 fi
57 if [ x"$IPUP_RUNQUEUE" = x"true" ] ; then
58 /usr/sbin/masqmail -qo &
59 fi
60 if [ x"$IPUP_FETCH" = x"true" ] ; then
61 /usr/sbin/masqmail -go &
62 fi
63 ;;
64 stop)
65 rm -f "$ROUTEFILE"
66 ;;
67 *)
68 echo "$0: unknown MODE"
69 ;;
70 esac
72 exit 0