Advertisement
s243a

rc.netwrok (lines 417 to 500) use wlan_ng

Oct 12th, 2016
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.38 KB | None | 0 0
  1. # lines 416 to 491  of /etc/rc.d/rc.network (puppylinux)
  2. # http://www.pearltrees.com/s243a/lines-408-650-rc-network/id16447168
  3.     # this should tell us if to use wlan_ng etc.
  4.     if [ "$USE_WLAN_NG" = "yes" ] ; then ####### use wlanctl-ng ########
  5.       if runPrismScan "$INTERFACE" ; then #>/dev/null
  6.         # go over access points (POINTNUM set in function)
  7.         for P in $(seq 0 $POINTNUM) ; do
  8.           grep -Fq 'resultcode=success' /tmp/prism-scan$P || continue
  9.           getPrismCellParameters $P
  10.           # we should have CELL_ESSID, CELL_CHANNEL,
  11.           # CELL_AP_MAC, CELL_MODE, CELL_ENCRYPTION
  12.           # see if access point configured
  13.           #### need to see about the ecryption part: gives "true" or "no_value"
  14.           case $CELL_ENCRYPTION in
  15.             true) CELL_ENCRYPTION=WEP ;;
  16.             *) CELL_ENCRYPTION=Open ;;
  17.           esac
  18.           if [ -f "${PROFILES_DIR}/${CELL_AP_MAC}.${CELL_ENCRYPTION}.conf" ] ; then
  19.             # unset static ip variables
  20.             unset STATIC_IP IP_ADDRESS NETMASK DNS_SERVER1 DNS_SERVER2 GATEWAY
  21.             # source it
  22.             . "${PROFILES_DIR}/${CELL_AP_MAC}.${CELL_ENCRYPTION}.conf"
  23.             assignProfileData
  24.             # try connection
  25.             if useWlanctl && sleep 1 && testInterface ; then
  26.               # sleep a bit, just in case (net-setup.sh has 5 seconds!)
  27.               #sleep 1
  28.               # try and get ip address
  29.               if try_and_connect ; then
  30.                 # done! stop everything.
  31.                 rm /tmp/wlan-up /tmp/prism-* >/dev/null 2>&1
  32.                 success_message
  33.                 #exit
  34.                 # move to next interface (to allow more than one)
  35.                 GOT_ONE="yes"
  36.                 continue 2
  37.               else
  38.                 failure_message
  39.               fi
  40.             elif [ "$CELL_ENCRYPTION" = "Open" ] ; then # add to list of open networks
  41.               OPEN_NETWORKS="$OPEN_NETWORKS $P"
  42.             else # failure of useWlanctl
  43.               failure_message
  44.             fi #if useWlanctl &&
  45.           fi #if [ -f "${PROFILES_DIR}/${CELL_AP_MAC}.${CELL_ENCRYPTION}.conf" ] ; then
  46.         done # for P in
  47.         # if we got here, we are not connected yet, look at open networks
  48.         if [ -n "$OPEN_NETWORKS" ] ; then
  49.           WLAN_SECURE="opensystem"
  50.           PROFILE_KEY=""
  51.           # unset static ip variables
  52.           unset STATIC_IP IP_ADDRESS NETMASK DNS_SERVER1 DNS_SERVER2 GATEWAY
  53.           for P in $OPEN_NETWORKS ; do
  54.             grep -Fq 'resultcode=success' /tmp/prism-scan$P || continue
  55.             getPrismCellParameters $P
  56.             # set the PROFILE_ variables
  57.             PROFILE_ESSID="$CELL_ESSID"
  58.             if useWlanctl && sleep 1 && testInterface ; then
  59.               # sleep a bit, just in case (net-setup.sh has 5 seconds!)
  60.               #sleep 1
  61.               # try and get ip address
  62.               if try_and_connect ; then
  63.                 # done! stop everything.
  64.                 rm /tmp/wlan-up /tmp/prism-* >/dev/null 2>&1
  65.                 success_message
  66.                 #exit
  67.                 # move to next interface (to allow more than one)
  68.                 GOT_ONE="yes"
  69.                 continue 2
  70.               else
  71.                 failure_message
  72.               fi
  73.             else # failure of useWlanctl
  74.               failure_message
  75.             fi
  76.           done
  77.         fi
  78. rm /tmp/wlan-up /tmp/prism-* >/dev/null 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement