copy trunk to buildroot-ng branch
[openwrt.git] / package / rp-pppoe / patches / rp-pppoe-3.5-scripts-fixes.patch
1 diff -ruN rp-pppoe-3.5-orig/scripts/adsl-connect.in rp-pppoe-3.5-4/scripts/adsl-connect.in
2 --- rp-pppoe-3.5-orig/scripts/adsl-connect.in   2002-07-08 16:38:24.000000000 +0200
3 +++ rp-pppoe-3.5-4/scripts/adsl-connect.in      2005-03-10 01:01:15.000000000 +0100
4 @@ -18,7 +18,7 @@
5  # Usage: adsl-connect [config_file]
6  #        adsl-connect interface user [config_file]
7  # Second form overrides USER and ETH from config file.
8 -# If config_file is omitted, defaults to /etc//ppp/pppoe.conf
9 +# If config_file is omitted, defaults to /etc/pppoe.conf
10  #
11  #***********************************************************************
12  
13 @@ -30,25 +30,22 @@
14  # Paths to programs
15  IFCONFIG=/sbin/ifconfig
16  PPPD=@PPPD@
17 -SETSID=@SETSID@
18 +SETSID=
19  PPPOE=@sbindir@/pppoe
20  LOGGER="/usr/bin/logger -t `basename $0`"
21  
22 +#MODPROBE=modprobe
23 +MODPROBE=insmod
24 +
25  # Set to "C" locale so we can parse messages from commands
26  LANG=C
27  export LANG
28  
29 -# Must be root
30 -if test "`@ID@ -u`" != 0 ; then
31 -    echo "$0: You must be root to run this script" >& 2
32 -    exit 1
33 -fi
34 -
35  if test "$SETSID" != "" -a ! -x "$SETSID"; then
36      SETSID=""
37  fi
38  
39 -CONFIG=/etc//ppp/pppoe.conf
40 +CONFIG=/etc/pppoe.conf
41  USER=""
42  ETH=""
43  
44 @@ -117,12 +114,12 @@
45  if test `uname -s` = Linux ; then
46      $IFCONFIG $ETH up mtu 1500
47      # For 2.4 kernels.  Will fail on 2.2.x, but who cares?
48 -    modprobe ppp_generic > /dev/null 2>&1
49 -    modprobe ppp_async > /dev/null 2>&1
50 -    modprobe ppp_synctty > /dev/null 2>&1
51 +    $MODPROBE ppp_generic > /dev/null 2>&1
52 +    $MODPROBE ppp_async > /dev/null 2>&1
53 +    $MODPROBE ppp_synctty > /dev/null 2>&1
54      if test -n "$LINUX_PLUGIN" ; then
55 -       modprobe pppox > /dev/null 2>&1
56 -       modprobe pppoe > /dev/null 2>&1
57 +       $MODPROBE pppox > /dev/null 2>&1
58 +       $MODPROBE pppoe > /dev/null 2>&1
59      fi
60  fi
61  
62 @@ -131,7 +128,7 @@
63      PPPD_SYNC=sync
64         # Increase the chances of it working on Linux...
65      if test `uname -s` = Linux ; then
66 -       modprobe n_hdlc > /dev/null 2>&1
67 +       $MODPROBE n_hdlc > /dev/null 2>&1
68      fi
69  else
70      PPPOE_SYNC=""
71 @@ -204,7 +201,7 @@
72  
73      # Interface name MUST BE LAST!!
74      PLUGIN_OPTS="$PLUGIN_OPTS $ETH"
75 -    modprobe pppoe > /dev/null 2>&1
76 +    $MODPROBE pppoe > /dev/null 2>&1
77  fi
78  
79  if test "$DEFAULTROUTE" != "no" ; then
80 diff -ruN rp-pppoe-3.5-orig/scripts/adsl-setup.in rp-pppoe-3.5-4/scripts/adsl-setup.in
81 --- rp-pppoe-3.5-orig/scripts/adsl-setup.in     2002-07-08 16:38:24.000000000 +0200
82 +++ rp-pppoe-3.5-4/scripts/adsl-setup.in        2005-03-09 17:24:02.000000000 +0100
83 @@ -27,7 +27,7 @@
84  LANG=C
85  export LANG
86  
87 -CONFIG=/etc/ppp/pppoe.conf
88 +CONFIG=/etc/pppoe.conf
89  
90  # Protect created files
91  umask 077
92 @@ -46,12 +46,6 @@
93  $ECHO "properly..."
94  $ECHO ""
95  
96 -# Must be root
97 -if [ "`@ID@ -u`" != 0 ] ; then
98 -    $ECHO "$0: Sorry, you must be root to run this script"
99 -    exit 1
100 -fi
101 -
102  # Prototype config file must exist
103  if [ ! -r "$CONFIG" ] ; then
104      $ECHO "Oh, dear, I don't see the file '$CONFIG' anywhere.  Please"
105 @@ -280,12 +274,7 @@
106      fi
107  fi
108  
109 -# Where is pppd likely to put its pid?
110 -if [ -d /var/run ] ; then
111 -    VARRUN=/var/run
112 -else
113 -    VARRUN=/etc/ppp
114 -fi
115 +VARRUN=/var/run
116  
117  # Some #$(*& ISP's use a slash in the user name...
118  sed -e "s&^USER=.*&USER='$U'&" \
119 diff -ruN rp-pppoe-3.5-orig/scripts/adsl-start.in rp-pppoe-3.5-4/scripts/adsl-start.in
120 --- rp-pppoe-3.5-orig/scripts/adsl-start.in     2002-07-08 16:38:24.000000000 +0200
121 +++ rp-pppoe-3.5-4/scripts/adsl-start.in        2005-03-10 00:53:13.000000000 +0100
122 @@ -18,7 +18,7 @@
123  # Usage: adsl-start [config_file]
124  #        adsl-start interface user [config_file]
125  # Second form overrides USER and ETH from config file.
126 -# If config_file is omitted, defaults to /etc/ppp/pppoe.conf
127 +# If config_file is omitted, defaults to /etc/pppoe.conf
128  #
129  #***********************************************************************
130  
131 @@ -36,15 +36,13 @@
132  export LANG
133  
134  # Defaults
135 -CONFIG=/etc/ppp/pppoe.conf
136 +CONFIG=/etc/pppoe.conf
137  USER=""
138  ETH=""
139  ME=`basename $0`
140 -# Must be root
141 -if [ "`@ID@ -u`" != 0 ] ; then
142 -    $ECHO "$ME: You must be root to run this script" >& 2
143 -    exit 1
144 -fi
145 +
146 +#TTY_S="tty -s"
147 +TTY_S=/bin/true
148  
149  # Debugging
150  if [ "$DEBUG" = "1" ] ; then
151 @@ -139,6 +137,8 @@
152      fi
153      # Delete bogus PIDFILE
154      rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start"
155 +else
156 +  mkdir -p /var/run
157  fi
158  
159  echo $$ > $PIDFILE.start
160 @@ -169,14 +169,14 @@
161      # Looks like the interface came up
162      if [ $? = 0 ] ; then
163         # Print newline if standard input is a TTY
164 -       tty -s && $ECHO " Connected!"
165 +       $TTY_S && $ECHO " Connected!"
166         exit 0
167      fi
168  
169      if test -n "$FORCEPING" ; then
170         $ECHO -n "$FORCEPING"
171      else
172 -       tty -s && $ECHO -n "$PING"
173 +       $TTY_S && $ECHO -n "$PING"
174      fi
175      sleep $CONNECT_POLL
176      TIME=`expr $TIME + $CONNECT_POLL`
177 diff -ruN rp-pppoe-3.5-orig/scripts/adsl-status rp-pppoe-3.5-4/scripts/adsl-status
178 --- rp-pppoe-3.5-orig/scripts/adsl-status       2002-07-08 16:38:24.000000000 +0200
179 +++ rp-pppoe-3.5-4/scripts/adsl-status  2005-03-10 01:01:17.000000000 +0100
180 @@ -15,12 +15,12 @@
181  # LIC: GPL
182  #
183  # Usage: adsl-status [config_file]
184 -# If config_file is omitted, defaults to /etc/ppp/pppoe.conf
185 +# If config_file is omitted, defaults to /etc/pppoe.conf
186  #
187  #***********************************************************************
188  
189  # Defaults
190 -CONFIG=/etc/ppp/pppoe.conf
191 +CONFIG=/etc/pppoe.conf
192  
193  case "$#" in
194      1)
195 @@ -58,10 +58,7 @@
196  
197  PPPD_PID=`cat "$PPPD_PIDFILE"`
198  
199 -# Sigh.  Some versions of pppd put PID files in /var/run; others put them
200 -# in /etc/ppp.  Since it's too messy to figure out what pppd does, we
201 -# try both locations.
202 -for i in /etc/ppp/ppp*.pid /var/run/ppp*.pid ; do
203 +for i in /var/run/ppp*.pid ; do
204      if [ -r $i ] ; then
205         PID=`cat $i`
206         if [ "$PID" = "$PPPD_PID" ] ; then
207 diff -ruN rp-pppoe-3.5-orig/scripts/adsl-stop.in rp-pppoe-3.5-4/scripts/adsl-stop.in
208 --- rp-pppoe-3.5-orig/scripts/adsl-stop.in      2002-07-08 16:38:24.000000000 +0200
209 +++ rp-pppoe-3.5-4/scripts/adsl-stop.in 2005-03-09 16:37:38.000000000 +0100
210 @@ -16,7 +16,7 @@
211  # LIC: GPL
212  #
213  # Usage: adsl-stop [config_file]
214 -# If config_file is omitted, defaults to /etc/ppp/pppoe.conf
215 +# If config_file is omitted, defaults to /etc/pppoe.conf
216  #
217  #***********************************************************************
218  
219 @@ -28,7 +28,7 @@
220  LOGGER="/usr/bin/logger -t $ME"
221  CONFIG="$1"
222  if [ "$CONFIG" = "" ] ; then
223 -    CONFIG=/etc/ppp/pppoe.conf
224 +    CONFIG=/etc/pppoe.conf
225  fi
226  
227  if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then