wok-6.x view tazndis/stuff/tazndisbox @ rev 20352

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