@@ -146,9 +146,9 @@ if [ "$token" = "token_id" ]; then
146146 echo " },"
147147 if [ -f /root/pw.conf ]; then
148148 source /root/pw.conf
149- echo " \" adapter\" :\" $inputAdapter \" ,"
150- echo " \" timeout\" :\" $inputTimeout \" ,"
151- echo " \" version\" :\" $inputVersion \" ,"
149+ echo " \" adapter\" :\" $interface \" ,"
150+ echo " \" timeout\" :\" $timeout \" ,"
151+ echo " \" version\" :\" $version \" ,"
152152 fi
153153 else
154154 echo " \" pppwn\" :false,"
@@ -181,13 +181,13 @@ if [ "$token" = "token_id" ]; then
181181 " start" )
182182
183183 if [ -f /root/pw.conf ]; then
184- sed -i " s/inputAdapter =.*/inputAdapter =$adapter /" /root/pw.conf
185- sed -i " s/inputTimeout =.*/inputTimeout =$timeout /" /root/pw.conf
186- sed -i " s/inputVersion =.*/inputVersion =$version /" /root/pw.conf
184+ sed -i " s/interface =.*/interface =$adapter /" /root/pw.conf
185+ sed -i " s/timeout =.*/timeout =$timeout /" /root/pw.conf
186+ sed -i " s/version =.*/version =$version /" /root/pw.conf
187187 else
188- echo -e " inputAdapter =$adapter \n" > /root/pw.conf
189- echo -e " inputTimeout =$timeout \n" >> /root/pw.conf
190- echo -e " inputVersion =$version \n" >> /root/pw.conf
188+ echo -e " interface =$adapter \n" > /root/pw.conf
189+ echo -e " timeout =$timeout \n" >> /root/pw.conf
190+ echo -e " version =$version \n" >> /root/pw.conf
191191 fi
192192
193193 if /etc/init.d/pppoe-server status | grep -q " running" ; then
@@ -232,21 +232,38 @@ if [ "$token" = "token_id" ]; then
232232 echo " /root/run.sh &" >> /etc/rc.local
233233 echo " exit 0" >> /etc/rc.local
234234 fi
235-
236- if grep -q " interface=" " /root/run.sh" ; then
237- sed -i " s/interface=\" .*\" /interface=\" $adapter \" /" " /root/run.sh"
238- fi
239- if grep -q " version=" " /root/run.sh" ; then
240- sed -i " s/version=\" .*\" /version=\" $version \" /" " /root/run.sh"
241- fi
242- if grep -q " timeout=" " /root/run.sh" ; then
243- sed -i " s/timeout=\" .*\" /timeout=\" $timeout \" /" " /root/run.sh"
244- fi
245- if grep -q " stage1=" " /root/run.sh" ; then
246- sed -i " s/stage1=\" .*\" /stage1=\" $stage1 \" /" " /root/run.sh"
247- fi
248- if grep -q " stage2=" " /root/run.sh" ; then
249- sed -i " s/stage2=\" .*\" /stage2=\" $stage2 \" /" " /root/run.sh"
235+
236+ if [ -f /root/pw.conf ]; then
237+
238+ if grep -q " interface=" " /root/pw.conf" ; then
239+ sed -i " s/interface=.*/interface=$adapter /" " /root/pw.conf"
240+ else
241+ echo -e " interface=$adapter " >> " /root/pw.conf"
242+ fi
243+ if grep -q " version=" " /root/pw.conf" ; then
244+ sed -i " s/version=.*/version=$version /" " /root/pw.conf"
245+ else
246+ echo -e " version=$version " >> " /root/pw.conf"
247+ fi
248+ if grep -q " timeout=" " /root/pw.conf" ; then
249+ sed -i " s/timeout=.*/timeout=$timeout /" " /root/pw.conf"
250+ else
251+ echo -e " timeout=$timeout " >> " /root/pw.conf"
252+ fi
253+ if grep -q " stage1=" " /root/pw.conf" ; then
254+ sed -i " /stage1=.*/d" " /root/pw.conf"
255+ echo -e " stage1=$stage1 " >> " /root/pw.conf"
256+ fi
257+ if grep -q " stage2=" " /root/pw.conf" ; then
258+ sed -i " /stage2=.*/d" " /root/pw.conf"
259+ echo -e " stage2=$stage2 " >> " /root/pw.conf"
260+ fi
261+ else
262+ echo -e " interface=$adapter " > /root/pw.conf
263+ echo -e " version=$version " >> /root/pw.conf
264+ echo -e " timeout=$timeout " >> /root/pw.conf
265+ echo -e " stage1=$stage1 " >> /root/pw.conf
266+ echo -e " stage2=$stage2 " >> /root/pw.conf
250267 fi
251268
252269 chmod +x /etc/rc.local
0 commit comments