summaryrefslogtreecommitdiff
blob: f45557a0d6f0993d14168363323a724448eb55fb (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
diff -Nru rp-pppoe-3.10.orig/configs/pppoe.conf rp-pppoe-3.10/configs/pppoe.conf
--- rp-pppoe-3.10.orig/configs/pppoe.conf	2008-06-30 16:00:42.000000000 +0200
+++ rp-pppoe-3.10/configs/pppoe.conf	2008-06-30 22:22:32.000000000 +0200
@@ -21,6 +21,9 @@
 # When you configure a variable, DO NOT leave spaces around the "=" sign.
 
 # Ethernet card connected to DSL modem
+#
+# NB: Gentoo overrides ETH when pppoe-start is called from the
+# networking scripts.  This setting has no effect in that case.
 ETH=eth1
 
 # PPPoE user name.  You may have to supply "@provider.com"  Sympatico
@@ -86,8 +89,10 @@
 #   $PIDFILE       contains PID of pppoe-connect script
 #   $PIDFILE.pppoe contains PID of pppoe process
 #   $PIDFILE.pppd  contains PID of pppd process
-CF_BASE=`basename $CONFIG`
-PIDFILE="/var/run/$CF_BASE-pppoe.pid"
+#
+# NB: Gentoo overrides PIDFILE when pppoe-start is run from the
+# networking scripts.  This setting has no effect in that case.
+PIDFILE="/var/run/rp-pppoe.pid"
 
 # Do you want to use synchronous PPP?  "yes" or "no".  "yes" is much
 # easier on CPU usage, but may not work for you.  It is safer to use
diff -Nru rp-pppoe-3.10.orig/scripts/pppoe-connect.in rp-pppoe-3.10/scripts/pppoe-connect.in
--- rp-pppoe-3.10.orig/scripts/pppoe-connect.in	2008-06-30 16:00:42.000000000 +0200
+++ rp-pppoe-3.10/scripts/pppoe-connect.in	2008-06-30 22:22:32.000000000 +0200
@@ -62,12 +62,17 @@
     ;;
 esac
 
-if test ! -f "$CONFIG" -o ! -r "$CONFIG" ; then
+# In Gentoo, CONFIG is a named pipe when pppoe is started by the
+# network scripts.  Testing -r is allowed; testing -f is not.
+if test ! -r "$CONFIG" ; then
     echo "$0: Cannot read configuration file '$CONFIG'" >& 2
     exit 1
 fi
-export CONFIG
-. $CONFIG
+
+# Read the named pipe (/dev/fd/foo) into a variable so we can use it
+# again later (since reading once from the pipe will exhaust it)
+CONFREAD=$(<$CONFIG)
+eval "$CONFREAD"
 
 PPPOE_PIDFILE="$PIDFILE.pppoe"
 PPPD_PIDFILE="$PIDFILE.pppd"
diff -Nru rp-pppoe-3.10.orig/scripts/pppoe-start.in rp-pppoe-3.10/scripts/pppoe-start.in
--- rp-pppoe-3.10.orig/scripts/pppoe-start.in	2008-06-30 16:00:42.000000000 +0200
+++ rp-pppoe-3.10/scripts/pppoe-start.in	2008-06-30 22:22:32.000000000 +0200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # @configure_input@
 #***********************************************************************
 #
@@ -113,12 +113,17 @@
 	;;
 esac
 
-if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
+# In Gentoo, CONFIG is a named pipe when pppoe is started by the
+# network scripts.  Testing -r is allowed; testing -f is not.
+if [ ! -r "$CONFIG" ] ; then
     $ECHO "$ME: Cannot read configuration file '$CONFIG'" >& 2
     exit 1
 fi
-export CONFIG
-. $CONFIG
+
+# Read the named pipe (/dev/fd/foo) into a variable so we can use it
+# again later (since reading once from the pipe will exhaust it)
+CONFREAD=$(<$CONFIG)
+eval "$CONFREAD"
 
 # Check for command-line overriding of ETH and USER
 case "$#" in
@@ -145,11 +150,11 @@
 
 # Start the connection in the background unless we're debugging
 if [ "$DEBUG" != "" ] ; then
-    $CONNECT "$@"
+    $CONNECT <(echo "$CONFREAD")
     exit 0
 fi
 
-$CONNECT "$@" > /dev/null 2>&1 &
+$CONNECT <(echo "$CONFREAD") >/dev/null 2>&1 &
 CONNECT_PID=$!
 
 if [ "$CONNECT_TIMEOUT" = "" -o "$CONNECT_TIMEOUT" = 0 ] ; then
@@ -164,7 +169,7 @@
 # Monitor connection
 TIME=0
 while [ true ] ; do
-    @sbindir@/pppoe-status $CONFIG > /dev/null 2>&1
+    @sbindir@/pppoe-status <(echo "$CONFREAD") >/dev/null 2>&1
 
     # Looks like the interface came up
     if [ $? = 0 ] ; then
diff -Nru rp-pppoe-3.10.orig/scripts/pppoe-status rp-pppoe-3.10/scripts/pppoe-status
--- rp-pppoe-3.10.orig/scripts/pppoe-status	2008-06-30 16:00:42.000000000 +0200
+++ rp-pppoe-3.10/scripts/pppoe-status	2008-06-30 22:22:32.000000000 +0200
@@ -28,12 +28,17 @@
 	;;
 esac
 
-if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
+# In Gentoo, CONFIG is a named pipe when pppoe is started by the
+# network scripts.  Testing -r is allowed; testing -f is not.
+if [ ! -r "$CONFIG" ] ; then
     echo "$0: Cannot read configuration file '$CONFIG'" >& 2
     exit 1
 fi
 
-. $CONFIG
+# Read the named pipe (/dev/fd/foo) into a variable so we can use it
+# again later (since reading once from the pipe will exhaust it)
+CONFREAD=$(<$CONFIG)
+eval "$CONFREAD"
 
 PPPOE_PIDFILE="$PIDFILE.pppoe"
 PPPD_PIDFILE="$PIDFILE.pppd"
diff -Nru rp-pppoe-3.10.orig/scripts/pppoe-stop.in rp-pppoe-3.10/scripts/pppoe-stop.in
--- rp-pppoe-3.10.orig/scripts/pppoe-stop.in	2008-06-30 16:00:42.000000000 +0200
+++ rp-pppoe-3.10/scripts/pppoe-stop.in	2008-06-30 22:22:32.000000000 +0200
@@ -31,12 +31,17 @@
     CONFIG=/etc/ppp/pppoe.conf
 fi
 
-if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
+# In Gentoo, CONFIG is a named pipe when pppoe is started by the
+# network scripts.  Testing -r is allowed; testing -f is not.
+if [ ! -r "$CONFIG" ] ; then
     echo "$ME: Cannot read configuration file '$CONFIG'" >& 2
     exit 1
 fi
-export CONFIG
-. $CONFIG
+
+# Read the named pipe (/dev/fd/foo) into a variable so we can use it
+# again later (since reading once from the pipe will exhaust it)
+CONFREAD=$(<$CONFIG)
+eval "$CONFREAD"
 
 PPPOE_PIDFILE="$PIDFILE.pppoe"
 PPPD_PIDFILE="$PIDFILE.pppd"