Advertisement
s243a

showProfileWindow() (/usr/sbin/wag-profiles) - Puppylinux

Oct 2nd, 2016
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.07 KB | None | 0 0
  1. #From line #309 of /usr/sbin/wag-profiles.sh
  2. # http://www.pearltrees.com/s243a/wag-profiles-sbin-puppylinux/id16403051
  3. showProfilesWindow()
  4. {
  5.     INTERFACE="$1"
  6.     # Dougal: find driver and set WPA driver from it
  7.     INTMODULE=$(readlink /sys/class/net/$INTERFACE/device/driver)
  8.     INTMODULE=${INTMODULE##*/}
  9.     case "$INTMODULE" in
  10.      #hostap*) CARD_WPA_DRV="hostap" ;; removed Oct 2011
  11.      #rt61|rt73) CARD_WPA_DRV="ralink" ;; removed Oct 2011
  12.      #r8180|r8187) CARD_WPA_DRV="ipw" ;; removed Oct 2011
  13.      # Dougal: all lines below are "wext" (split and alphabetized for readability)
  14.      r8180|rtl819*|vt665*) CARD_WPA_DRV="wext" ;;#v511
  15.      ath_pci) modprobe wlan_tkip ; CARD_WPA_DRV="wext" ;;
  16.      ath5k*|ath9k*|b43|b43legacy|bcm43xx) CARD_WPA_DRV="wext" ;;
  17.      ipw2100|ipw2200|ipw3945|iwl3945|iwl4965|iwl5100|iwlagn) CARD_WPA_DRV="wext" ;;
  18.      ndiswrapper|p54pci|p54usb|rndis_wlan) CARD_WPA_DRV="wext" ;;
  19.      rt61pci|rt73usb|rt2400pci|rt2500*|rt28[67]0*|rtl8180|rtl8187) CARD_WPA_DRV="wext" ;;
  20.      zd1211|zd1211b|zd1211rw) CARD_WPA_DRV="wext" ;;
  21.      ar9170usb|at76c50x-usb|libertas_cs|libertas_sdio|libertas_tf_usb|mwl8k|usb8xxx) CARD_WPA_DRV="wext" ;; #v430
  22.      usb|brcm*|hostap*) CARD_WPA_DRV="wext" ;; #Sep 2011, Oct 2011
  23.      ar55*) CARD_WPA_DRV="wext" ;; #tempestuous April 2011
  24.      *) # doesn't support WPA encryption
  25.        # add an option to add modules to file
  26.        if [ -f "$Extra_WPA_Modules_File" ] &&\
  27.             CARD_WPA_DRV=$(grep -m1 "^$INTMODULE:" $Extra_WPA_Modules_File) ; then
  28.          CARD_WPA_DRV=${CARD_WPA_DRV#*:}
  29.        else
  30.          CARD_WPA_DRV=""
  31.          giveNoWPADialog
  32.        fi
  33.        ;;
  34.     esac
  35.    
  36.     # Dougal: add usage of wlan-ng, for prism2_usb module
  37.     case "$INTMODULE" in prism2_*) USE_WLAN_NG="yes" ;; esac
  38.    
  39.     refreshProfilesWindowInfo
  40.     setupNewProfile
  41.     EXIT=""
  42.     while true
  43.     do
  44.  
  45.         buildProfilesWindow
  46.  
  47.         I=$IFS; IFS=""
  48.         ## Add escaping of funny chars before we eval the statement!
  49.         for STATEMENT in  $(gtkdialog3 --program NETWIZ_Profiles_Window | sed 's%\$%\\$%g ; s%`%\\`%g ; s%"%\\"%g ; s%=\\"%="%g ; s%\\"$%"%g' ); do
  50.             eval $STATEMENT
  51.         done
  52.         IFS=$I
  53.         clean_up_gtkdialog NETWIZ_Profiles_Window
  54.         unset NETWIZ_Profiles_Window
  55.  
  56.         case "$EXIT" in
  57.             "abort" | "19" ) # Back or close window
  58.                 break
  59.                 ;; # Do Nothing, It will exit the while loop
  60.             "11" ) # Scan
  61.                 showScanWindow
  62.                 ;;
  63.             "12" ) # New profile
  64.                 setupNewProfile
  65.                 ;;
  66.             "20" ) # Save
  67.                 assembleProfileData
  68.                 saveProfiles
  69.                 refreshProfilesWindowInfo
  70.                 loadProfileData "${CURRENT_PROFILE}"
  71.                 ;;
  72.             "21" ) # Delete
  73.                 deleteProfile
  74.                 NEW_PROFILE_DATA=""
  75.                 #saveProfiles
  76.                 refreshProfilesWindowInfo
  77.                 setupNewProfile
  78.                 ;;
  79.             "22" ) # Use This Profile
  80.                   if useProfile ; then
  81.                     return 0
  82.                   else # Dougal: add new message to say it failed
  83.                     return 2
  84.                   fi
  85.                 ;;
  86.             "40" ) # Advanced fields
  87.                 if [ "$ADVANCED" ] ; then
  88.                     unset -v ADVANCED
  89.                 else
  90.                     ADVANCED=1
  91.                 fi
  92.                 ;;
  93.             ##  Dougal: comment out all the button shading below, so they
  94.             ##+ only get shaded when loading a profile!
  95.             "50" ) # No encryption
  96.                 PROFILE_ENCRYPTION="Open"
  97.                 #ENABLE_WEP_BUTTON='false'
  98.                 #ENABLE_WPA_BUTTON='false'
  99.                 #ENABLE_WPA2_BUTTON='false'
  100.                 #ENABLE_OPEN_BUTTON='true'
  101.                 ;;
  102.             "51" ) # WEP
  103.                 PROFILE_ENCRYPTION="WEP"
  104.                 #ENABLE_WEP_BUTTON='true'
  105.                 #ENABLE_WPA_BUTTON='false'
  106.                 #ENABLE_WPA2_BUTTON='false'
  107.                 #ENABLE_OPEN_BUTTON='false'
  108.                 ;;
  109.             "52" ) # WPA
  110.                 PROFILE_ENCRYPTION="WPA"
  111.                 PROFILE_WPA_TYPE=""
  112.                 #ENABLE_WEP_BUTTON='false'
  113.                 #ENABLE_WPA_BUTTON='true'
  114.                 #ENABLE_WPA2_BUTTON='false'
  115.                 #ENABLE_OPEN_BUTTON='false'
  116.                 ;;
  117.             "53" ) # WPA2
  118.                 PROFILE_ENCRYPTION="WPA2"
  119.                 PROFILE_WPA_TYPE="2"
  120.                 #ENABLE_WEP_BUTTON='false'
  121.                 #ENABLE_WPA_BUTTON='false'
  122.                 #ENABLE_WPA2_BUTTON='true'
  123.                 #ENABLE_OPEN_BUTTON='false'
  124.                 ;;
  125.             load) # If it wasn't any other button, it must be a profile button
  126.                 PROFILE_TITLES="$( echo "$PROFILE_TITLES" | grep -v \"#NEW#\" )"
  127.                 CURRENT_PROFILE="$PROFILE_COMBO"
  128.                 loadProfileData "$CURRENT_PROFILE"
  129.                
  130.                 ;;
  131.         esac
  132.     done
  133.     return 1
  134. } # end showProfilesWindow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement