wok-next annotate tazndis/stuff/tazndisbox @ rev 14227
linux: update wget_url
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Mar 21 21:44:13 2013 +0100 (2013-03-21) |
parents | 49e766e49c35 |
children |
rev | line source |
---|---|
pankso@2274 | 1 #!/bin/sh |
pankso@2274 | 2 # |
pankso@2274 | 3 # GTKdialog interface to tazndis: let users manage easly Windows drivers. |
pankso@2274 | 4 # Use tabs to indent, split commands from the GUI and use functions. |
pankso@2274 | 5 # |
pankso@2274 | 6 # (c) 2009 SliTaz GNU/Linux - GNU gpl v3 |
pankso@2274 | 7 # |
pankso@2274 | 8 |
pankso@2274 | 9 # Languages messages translations |
pankso@2274 | 10 |
pankso@2274 | 11 case $LANG in |
pankso@2274 | 12 fr*) |
pankso@2274 | 13 REMOVE_DRIVER_MSG="Double clique sur un driver pour le supprimer." |
pankso@2274 | 14 FILE_ENTRY_MSG="Fichier (.inf):" |
pankso@2274 | 15 BUTTON_MSG="Installer" |
pankso@2274 | 16 MODULE_STATUS_MSG="Module noyau ndiswrapper" |
pankso@2274 | 17 LOADED_STATUS_MSG="chargé" |
pankso@2274 | 18 UNLOADED_STATUS_MSG="déchargé" |
pankso@2274 | 19 LOAD_BUTTON="Charger" |
pankso@2274 | 20 UNLOAD_BUTTON="Décharger" |
pankso@2274 | 21 EXIT_BUTTON="Quitter" ;; |
pankso@2274 | 22 *) |
paul@2313 | 23 REMOVE_DRIVER_MSG="Please double click on a driver to remove it." |
pankso@2274 | 24 FILE_ENTRY_MSG="File (.inf):" |
pankso@2274 | 25 BUTTON_MSG="Install" |
pankso@2274 | 26 MODULE_STATUS_MSG="Ndiswrapper Kernel module" |
pankso@2274 | 27 LOADED_STATUS_MSG="loaded" |
pankso@2274 | 28 UNLOADED_STATUS_MSG="unloaded" |
pankso@2274 | 29 LOAD_BUTTON="Load" |
pankso@2274 | 30 UNLOAD_BUTTON="Unload" |
pankso@2274 | 31 EXIT_BUTTON="Exit" ;; |
pankso@2274 | 32 esac |
pankso@2274 | 33 |
pankso@2274 | 34 # Tazndisbox is only for root. |
pankso@2274 | 35 if test $(id -u) != 0 ; then |
pankso@2274 | 36 exec subox tazndisbox |
pankso@2274 | 37 exit 0 |
pankso@2274 | 38 fi |
pankso@2274 | 39 |
pankso@2274 | 40 # Functions |
pankso@2274 | 41 |
pankso@2274 | 42 list_drivers() |
pankso@2274 | 43 { |
pankso@2274 | 44 tazndis -l | sed 's/:/|/' |
pankso@2274 | 45 } |
pankso@2274 | 46 |
pankso@2274 | 47 install_driver() |
pankso@2274 | 48 { |
pankso@2274 | 49 xterm -bg gray93 -fg black -geometry 60x12 -title "Tazndis install" \ |
pankso@2274 | 50 -e "echo N | tazndis -i $NEW_DRIVER" |
pankso@2274 | 51 } |
pankso@2274 | 52 |
pankso@2274 | 53 remove_driver() |
pankso@2274 | 54 { |
pankso@2274 | 55 tazndis -r $DRIVER |
pankso@2274 | 56 } |
pankso@2274 | 57 |
pankso@2274 | 58 module_status() |
pankso@2274 | 59 { |
pankso@2274 | 60 if lsmod | grep -q ndiswrapper; then |
pankso@2274 | 61 STATUS="$LOADED_STATUS_MSG" |
pankso@2274 | 62 else |
pankso@2274 | 63 STATUS="$UNLOADED_STATUS_MSG" |
pankso@2274 | 64 fi |
pankso@2274 | 65 echo -n "$MODULE_STATUS_MSG ($STATUS)" |
pankso@2274 | 66 } |
pankso@2274 | 67 |
pankso@2274 | 68 load_module() |
pankso@2274 | 69 { |
pankso@2274 | 70 if ! lsmod | grep -q ^ndiswrapper; then |
pankso@2274 | 71 modprobe ndiswrapper |
pankso@2274 | 72 fi |
pankso@2274 | 73 } |
pankso@2274 | 74 |
pankso@2274 | 75 unload_module() |
pankso@2274 | 76 { |
pankso@2274 | 77 if lsmod | grep -q ^ndiswrapper; then |
pankso@2274 | 78 rmmod ndiswrapper |
pankso@2274 | 79 fi |
pankso@2274 | 80 } |
pankso@2274 | 81 |
pankso@2274 | 82 # GUI |
pankso@2274 | 83 |
pankso@2274 | 84 export MAIN_DIALOG=" |
pankso@2274 | 85 <window title=\"Tazndisbox\" icon-name=\"system-installer\"> |
pankso@2274 | 86 <vbox> |
pankso@2274 | 87 |
pankso@2274 | 88 <tree> |
pankso@2274 | 89 <width>510</width><height>140</height> |
pankso@2274 | 90 <variable>DRIVER</variable> |
pankso@2274 | 91 <label>Driver|Info</label> |
pankso@2274 | 92 <input>$0 list_drivers</input> |
pankso@2274 | 93 <action>$0 remove_driver</action> |
pankso@2274 | 94 <action>refresh:DRIVER</action> |
pankso@2274 | 95 </tree> |
pankso@2274 | 96 |
pankso@2274 | 97 <hbox> |
pankso@2274 | 98 <text width-chars=\"56\"> |
pankso@2274 | 99 <label>\"$REMOVE_DRIVER_MSG\"</label> |
pankso@2274 | 100 </text> |
pankso@2274 | 101 </hbox> |
pankso@2274 | 102 |
pankso@2274 | 103 <hbox> |
pankso@2274 | 104 <text> |
pankso@2274 | 105 <label>$FILE_ENTRY_MSG</label> |
pankso@2274 | 106 </text> |
pankso@2274 | 107 <entry accept=\"filename\"> |
pankso@2274 | 108 <label>Select a driver</label> |
pankso@2274 | 109 <variable>NEW_DRIVER</variable> |
pankso@2274 | 110 </entry> |
pankso@2274 | 111 <button> |
pankso@2274 | 112 <input file stock=\"gtk-open\"></input> |
pankso@2274 | 113 <action type=\"fileselect\">NEW_DRIVER</action> |
pankso@2274 | 114 </button> |
pankso@2274 | 115 <button> |
pankso@2274 | 116 <label>$BUTTON_MSG</label> |
pankso@2274 | 117 <input file icon=\"forward\"></input> |
pankso@2274 | 118 <action>$0 install_driver</action> |
pankso@2274 | 119 <action>refresh:DRIVER</action> |
pankso@2274 | 120 <action>refresh:MODULE</action> |
pankso@2274 | 121 <action>clear:NEW_DRIVER</action> |
pankso@2274 | 122 </button> |
pankso@2274 | 123 </hbox> |
pankso@2274 | 124 |
pankso@2274 | 125 <hbox> |
pankso@2274 | 126 <text> |
pankso@2274 | 127 <variable>MODULE</variable> |
pankso@2274 | 128 <input>$0 module_status</input> |
pankso@2274 | 129 </text> |
pankso@2274 | 130 <button> |
pankso@2274 | 131 <label>$LOAD_BUTTON</label> |
pankso@2274 | 132 <input file icon=\"forward\"></input> |
pankso@2274 | 133 <action>$0 load_module</action> |
pankso@2274 | 134 <action>refresh:MODULE</action> |
pankso@2274 | 135 </button> |
pankso@2274 | 136 <button> |
pankso@2274 | 137 <label>$UNLOAD_BUTTON</label> |
pankso@2274 | 138 <input file icon=\"undo\"></input> |
pankso@2274 | 139 <action>$0 unload_module</action> |
pankso@2274 | 140 <action>refresh:MODULE</action> |
pankso@2274 | 141 </button> |
pankso@2274 | 142 <button> |
pankso@2274 | 143 <label>$EXIT_BUTTON</label> |
pankso@2274 | 144 <input file icon=\"exit\"></input> |
pankso@2274 | 145 <action type=\"exit\">Exit</action> |
pankso@2274 | 146 </button> |
pankso@2274 | 147 </hbox> |
pankso@2274 | 148 |
pankso@2274 | 149 </vbox> |
pankso@2274 | 150 </window>" |
pankso@2274 | 151 |
pankso@2274 | 152 if [ -n "$1" ]; then |
pankso@2274 | 153 $1 |
pankso@2274 | 154 else |
pankso@2274 | 155 gtkdialog --center --program=MAIN_DIALOG #>/dev/null |
pankso@2274 | 156 fi |
pankso@2274 | 157 |
pankso@2274 | 158 exit 0 |