Advertisement
s243a

unloadSpecificModule () - Network Wizard - Puppylinux

Nov 29th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.83 KB | None | 0 0
  1. unloadSpecificModule(){
  2.   TOPMSG=""
  3.   LOADED_ITEMS=""
  4.   while read ONE
  5.   do
  6.     [ "$ONE" ] || continue
  7.     LOADED_ITEMS="$LOADED_ITEMS <item>$ONE</item>"
  8.   done</tmp/loadedeth.txt
  9.  
  10.   # see if there's anything at all...
  11.   if [ ! "$LOADED_ITEMS" ] ; then
  12.     giveErrorDialog "$L_MESSAGE_No_Loaded_Items"
  13.     return
  14.   fi
  15.  
  16.   export NETWIZ_Unload_Module_Window="<window title=\"$L_TITLE_Unload_A_Module\" icon-name=\"gtk-network\" window-position=\"1\">
  17. <vbox>
  18.  <text>
  19.    <label>\"$L_TEXT_Unload_A_Module\"</label>
  20.  </text>
  21.  <hbox>
  22.    <text>
  23.      <label>$L_COMBO_Module</label>
  24.    </text>
  25.    <combobox>
  26.      <variable>COMBOBOX</variable>
  27.      $LOADED_ITEMS
  28.    </combobox>
  29.  </hbox>
  30.  <hbox>
  31.   <button>
  32.     <label>$L_BUTTON_Unload</label>
  33.     <input file stock=\"gtk-undo\"></input>
  34.     <action>EXIT:Unload</action>
  35.   </button>
  36.   <button cancel></button>
  37.  </hbox>
  38. </vbox>
  39. </window>"
  40.  
  41.   I=$IFS; IFS=""
  42.   for STATEMENT in  $(gtkdialog3 --program NETWIZ_Unload_Module_Window); do
  43.     eval $STATEMENT 2>/dev/null
  44.   done
  45.   IFS=$I
  46.   clean_up_gtkdialog NETWIZ_Unload_Module_Window
  47.   unset NETWIZ_Unload_Module_Window
  48.  
  49.   if [ "$EXIT" = "Unload" ] ; then
  50.     if [ "$COMBOBOX" ] ; then #making sure there was something
  51.       if ERROR=$(rmmod $COMBOBOX 2>&1) ; then # it worked, remove from list
  52.         sed -i "/^ $COMBOBOX*/d" /tmp/loadedeth.txt
  53.         # ask the user about blacklisting
  54.         offerToBlacklistModule "$COMBOBOX"
  55.         # need to refresh the main gui, since # of interfaces has changed
  56.         setDefaultMODULEBUTTONS
  57.         refreshMainWindowInfo
  58.       else # failed to remove: give message
  59.         giveErrorDialog "$L_MESSAGE_Remove_Module_Failed_p1 $COMBOBOX.
  60. $L_MESSAGE_Remove_Module_Failed_p2
  61. $ERROR"
  62.       fi #if rmmod $COMBOBOX ; then
  63.    
  64.     fi #if [ "$COMBOBOX" ] ; then
  65.   fi #if [ "$EXIT" = "Unload" ] ; then
  66. } # end unloadSpecificModule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement