Bugfix: rc.network in Puppy 2.14 through 2.17.1
Posted: Sat 25 Aug 2007, 13:10
I've found a bug in rc.network that may help explain why the ifplugstatus function has been unreliable ever since execution of rc.network was put into the background in Puppy 2.14, ie, executed as a separate process from rc.local0.
The problem lies in line 114 (Puppy 2.17.1):
This command does not work correctly when rc.network is run in the background. The line does not produce a delay. I've tested this by monitoring the loop to a temp file with the 'date' command and the number of iterations.
I commented-out line 114 and the following line, as interrupting the loop when run in the background with "Enter" makes no sense, and added this line:
So the complete patch looks like this:
Original code from Puppy 2.17.1:
Previously, on an Acer with the wireless interface set up, rc.network did not start the interface since the link beat took 2.5 sec to start. It now works at every boot
The problem lies in line 114 (Puppy 2.17.1):
Code: Select all
read -t ${TRY_DELAY} a
I commented-out line 114 and the following line, as interrupting the loop when run in the background with "Enter" makes no sense, and added this line:
Code: Select all
sleep ${TRY_DELAY}
Code: Select all
if [ "`ifplugstatus${IFVER} ${INTERFACE} | grep "link beat detected"`" = "" ]; then
#read -t ${TRY_DELAY} a
#[ $? -eq 0 ] && TRY_COUNT=${TRY_MAX_COUNT}
#pakt: 'read -t <delay>' doesn't work when rc.network is run as a separate process
sleep ${TRY_DELAY} #use this instead
else
UNPLUGGED='false'
TRY_COUNT=${TRY_MAX_COUNT}
fi
Code: Select all
if [ "`ifplugstatus${IFVER} ${INTERFACE} | grep "link beat detected"`" = "" ]; then
read -t ${TRY_DELAY} a
[ $? -eq 0 ] && TRY_COUNT=${TRY_MAX_COUNT}
else
UNPLUGGED='false'
TRY_COUNT=${TRY_MAX_COUNT}
fi