Advertisement
s243a

askWhichInterfaceForNdiswrapper() - Network Wizard - Puppylinux

Nov 29th, 2016
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.90 KB | None | 0 0
  1. askWhichInterfaceForNdiswrapper(){
  2.     TEMP=""
  3.     for ONE in $INTERFACES
  4.     do
  5.       [ "$ONE" ] || continue
  6.       TEMP="$TEMP
  7.     <button>
  8.      <label>$ONE</label>
  9.      <action>EXIT:$ONE</action>
  10.    </button>"  
  11.     done
  12.     # don't ask if there are no interfaces at all...
  13.     [ "$TEMP" ] || return 0
  14.  
  15.     export NETWIZ_Select_Ndiswrapper_Interface_Dialog="<window title=\"$L_TITLE_Puppy_Network_Wizard\" icon-name=\"gtk-network\" window-position=\"1\">
  16. <vbox>
  17.  <pixmap icon_size=\"6\">
  18.      <input file stock=\"gtk-dialog-question\"></input>
  19.    </pixmap>
  20.  <text use-markup=\"true\">
  21.    <label>\"$L_TEXT_Ask_Which_Interface_For_Ndiswrapper\"</label>
  22.  </text>  
  23.  <hbox>
  24.    $TEMP
  25.    <button>
  26.      <label>$L_BUTTON_None</label>
  27.      <action>EXIT:none</action>
  28.    </button>
  29.    <button cancel></button>
  30.  </hbox>
  31. </vbox>
  32. </window>"
  33.  
  34.     I=$IFS; IFS=""
  35.     for STATEMENT in  $(gtkdialog3 --program NETWIZ_Select_Ndiswrapper_Interface_Dialog); do
  36.     eval $STATEMENT
  37.     done
  38.     IFS=$I
  39.     clean_up_gtkdialog NETWIZ_Select_Ndiswrapper_Interface_Dialog
  40.     unset NETWIZ_Select_Ndiswrapper_Interface_Dialog
  41.  
  42.     case $EXIT in
  43.      none) return 0 ;;
  44.      Cancel|abort) return 1 ;;
  45.     esac
  46.     # if we got here, it's an interface
  47.     AMOD=$(readlink /sys/class/net/$EXIT/device/driver/module)
  48.     AMOD=${AMOD##*/}
  49.     AMOD=${AMOD//_/-}
  50.     #echo $AMOD
  51.     ##  Need to have an exception for the acx modules, since unloading them
  52.     ##+ causes the kernel to become unstable
  53.     case $AMOD in acx*) giveAcxDialog "$AMOD" || return 1 ;; esac
  54.     # Try removing module
  55.     if ERROR=$(rmmod $AMOD 2>&1) ; then
  56.       # ask the user if to blacklist
  57.       offerToBlacklistModule "$AMOD"
  58.       # need to refresh the main gui, since # of interfaces has changed
  59.       setDefaultMODULEBUTTONS
  60.       refreshMainWindowInfo
  61.       return 0
  62.     else # failed to remove: give message
  63.       giveErrorDialog "$L_MESSAGE_Remove_Module_Failed_p1 $AMOD.
  64. $L_MESSAGE_Remove_Module_Failed_p2
  65. $ERROR"
  66.       return 1
  67.     fi
  68. } # end askWhichInterfaceForNdiswrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement