Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lines 992 to 1063 of /usr/sbin/net-setup.sh
- # http://www.pearltrees.com/s243a/testinterface-setup-puppylinux/id16441463
- testInterface()
- {
- INTERFACE="$1"
- (
- UNPLUGGED="false"
- ifconfig "$INTERFACE" | grep ' UP ' >> $DEBUG_OUTPUT 2>&1
- if [ ! $? -eq 0 ];then #=0 if found
- #cleanUpInterface "$INTERFACE" >> $DEBUG_OUTPUT 2>&1
- # Dougal: add check for error -- maybe it fails to be raised?
- if ! ERROR=$(ifconfig "$INTERFACE" up 2>&1) ; then
- giveErrorDialog "$L_MESSAGE_Failed_Raise_Interface_p1 $INTERFACE.
- $L_MESSAGE_Failed_Raise_Interface_p2 ifconfig $INTERFACE up
- $L_MESSAGE_Failed_Raise_Interface_p3
- $ERROR
- "
- fi
- fi
- #BK1.0.7 improved link-beat detection...
- echo "X"
- #091108 old ifplugstatus now -0.18, latest is just 'ifplugstatus'...
- # 25feb10: shinobar: old and new ifplugstatus
- IFPLUGOLD=ifplugstatus
- IFPLUGNEW=ifplugstatus
- [ -x /sbin/ifplugstatus-0.18 ] && IFPLUGOLD=ifplugstatus-0.18
- [ -x /sbin/ifplugstatus-0.25 ] && IFPLUGNEW=ifplugstatus-0.25
- if ! $IFPLUGOLD "$INTERFACE" | grep -F -q 'link beat detected' ;then
- sleep 2
- echo "X"
- if ! $IFPLUGNEW "$INTERFACE" | grep -F -q 'link beat detected' ;then
- sleep 2
- echo "X"
- if ! $IFPLUGOLD "$INTERFACE" | grep -F -q 'link beat detected' ;then
- sleep 2
- echo "X"
- if ! $IFPLUGNEW "$INTERFACE" | grep -F -q 'link beat detected' ;then
- # add ethtool test, just in case it helps at times...
- sleep 1
- echo "X"
- if ! ethtool "$INTERFACE" | grep -Fq 'Link detected: yes' ; then
- UNPLUGGED="true"
- fi
- fi
- fi
- fi
- fi
- echo "${UNPLUGGED}" > /tmp/net-setup_UNPLUGGED.txt
- ) | Xdialog --title "$L_TITLE_Network_Wizard" --progress "$L_PROGRESS_Testing_Interface ${INTERFACE}" 0 0 5
- UNPLUGGED=$(cat /tmp/net-setup_UNPLUGGED.txt)
- if [ "$UNPLUGGED" != "false" ];then #BK1.0.7
- #no cable plugged in, no network connection possible...
- ifconfig "$INTERFACE" down
- BGCOLOR="#ffc0c0"
- if [ "${IS_WIRELESS}" ] ; then
- TOPMSG="$(eval echo $L_TOPMSG_Report_On_Test)
- $L_TOPMSG_Unplugged_Wireless"
- else
- TOPMSG="$(eval echo $L_TOPMSG_Report_On_Test)
- $L_TOPMSG_Unplugged_Wired"
- RETTEST=1
- fi
- else
- BGCOLOR="#e0ffe0"
- TOPMSG="$(eval echo $L_TOPMSG_Report_On_Test)
- $L_TOPMSG_Network_Alive"
- RETTEST=0
- fi
- return $RETTEST
- } # end of testInterface
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement