Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lines 1805 to 1867 of wag-profiles.sh
- # http://www.pearltrees.com/s243a/buildscanwindow-puppylinux/id16473165
- # $1 might be "retry", to let us know we've already tried once...
- buildScanWindow()
- {
- SCANWINDOW_BUTTONS=""
- (
- #ifconfig "$INTERFACE" up
- #cleanUpInterface "$INTERFACE" >> $DEBUG_OUTPUT 2>&1
- # Dougal: use files for the scan results, so we can try a few times
- #+ and see which is biggest (sometimes not all networks show)
- rm /tmp/net-setup_scan*.tmp >/dev/null 2>&1
- iwlist "$INTERFACE" scan >/tmp/net-setup_scan1.tmp 2>>$DEBUG_OUTPUT
- echo "X"
- #SCANALL=$(iwlist "$INTERFACE" scan 2>>$DEBUG_OUTPUT)
- sleep 1
- iwlist "$INTERFACE" scan >/tmp/net-setup_scan2.tmp 2>>$DEBUG_OUTPUT
- echo "X"
- ScanListFile=$(du -b /tmp/net-setup_scan*.tmp |sort -n | tail -n1 |cut -f2)
- # Dougal: if nothing found, try again!
- # (put the retry here, so progress is more even in bar...)
- #case "$SCANALL" in *'No scan results'*)
- #if grep -Fq 'No scan results' $ScanListFile ; then
- # sleep 1
- #SCANALL=$(iwlist "$INTERFACE" scan 2>>$DEBUG_OUTPUT)
- # iwlist "$INTERFACE" scan >/tmp/net-setup_scan3.tmp 2>>$DEBUG_OUTPUT
- # ScanListFile="/tmp/net-setup_scan3.tmp"
- #;;
- #esac
- #fi
- #SCAN_LIST=$(echo "$SCANALL" | grep 'Cell\|ESSID\|Mode\|Frequency\|Quality\|Encryption\|Channel\|IE:\|Extra:')
- #echo "$SCAN_LIST" > /tmp/net-setup_scanlist
- echo "$ScanListFile" > /tmp/net-setup_scanlistfile
- CELL_LIST=$(grep -Eo "Cell [0-9]+" $ScanListFile | cut -f2 -d " ")
- #if [ -z "$SCAN_LIST" ]; then
- if [ -z "$CELL_LIST" ]; then
- # Dougal: a little awkward... want to give an option to reset pcmcia card
- FI_DRIVER=$(readlink /sys/class/net/$INTERFACE/device/driver)
- if [ "$1" = "retry" ] ; then # we're on the second try already
- createNoNetworksDialog
- #echo "Xdialog --left --title \"Puppy Network Wizard:\" --msgbox \"No networks detected\" 0 0 " > /tmp/net-setup_scanwindow
- elif [ -n "$IsPCMCIA" ] ; then
- createRetryPCMCIAScanDialog
- else
- createRetryScanDialog
- fi
- else
- # give each Cell its own button
- #CELL_LIST=$(echo "$SCAN_LIST" | grep -Eo "Cell [0-9]+" | cut -f2 -d " ")
- for CELL in $CELL_LIST ; do
- #getCellParameters $CELL
- Get_Cell_Parameters $CELL
- [ -z "$CELL_ESSID" ] && CELL_ESSID="(hidden ESSID)"
- SCANWINDOW_BUTTONS="$SCANWINDOW_BUTTONS \"$CELL\" \"$CELL_ESSID (${CELL_MODE}; ${L_SCANWINDOW_Encryption}$CELL_ENC_TYPE)\" off \"${L_SCANWINDOW_Channel}${CELL_CHANNEL}; ${L_SCANWINDOW_Frequency}${CELL_FREQ}; ${L_SCANWINDOW_AP_MAC}${CELL_AP_MAC};
- ${L_SCANWINDOW_Strength}${CELL_QUALITY}\""
- done
- echo "Xdialog --left --item-help --stdout --title \"$L_TITLE_Puppy_Network_Wizard\" --radiolist \"$L_TEXT_Scanwindow\" 20 60 4 \
- ${SCANWINDOW_BUTTONS} 2> /dev/null" > /tmp/net-setup_scanwindow
- fi
- echo "X"
- ) | gtkdialog3 --program=NETWIZ_Scan_Progress_Dialog >/dev/null
- clean_up_gtkdialog NETWIZ_Scan_Progress_Dialog
- #Xdialog --title "Puppy Ethernet Wizard" --progress "Scanning wireless networks" 0 0 3
- #SCAN_LIST="$(cat /tmp/net-setup_scanlist)"
- read ScanListFile < /tmp/net-setup_scanlistfile
- # run ifconfig down/up, as apparently it is needed for actually configuring to work properly...
- ifconfig "$INTERFACE" down
- ifconfig "$INTERFACE" up
- } #end of buildScanWindow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement