rev |
line source |
jozee@457
|
1 #!/bin/sh
|
jozee@457
|
2 # usage: hwsetup [device]
|
jozee@457
|
3 # e.g., hwsetup printer
|
gokhlayeh@497
|
4 # #
|
jozee@457
|
5 # (c) - SliTaz GNU/Linux 2009 - GNU GPL v3
|
jozee@457
|
6 # Authors : Rohit Joshi <jozee@slitaz.org>
|
jozee@457
|
7 #
|
jozee@457
|
8
|
jozee@457
|
9 DEVICE=$1
|
jozee@460
|
10 DEPENDS=""
|
jozee@457
|
11 AUTO_INSTALL_SUGGESTED="no"
|
jozee@457
|
12 CONFIRM_SUGGESTED="no"
|
jozee@457
|
13 NON_FREE="no"
|
jozee@457
|
14 DETECTED="no"
|
jozee@457
|
15
|
jozee@457
|
16 usage()
|
jozee@457
|
17 {
|
jozee@457
|
18 echo -e "\nSliTaz Setup configuration\n
|
jozee@457
|
19 \033[1mUsage: \033[0m `basename $0` [command] [--option]
|
jozee@457
|
20
|
jozee@457
|
21 \033[1mCommands: \033[0m
|
jozee@457
|
22 usage Print this short usage.
|
paul@549
|
23 printer Parallel and USB Printer setup.
|
jozee@457
|
24 scanner USB Scanner setup.
|
jozee@457
|
25 webcam Integrated and USB webcam setup.
|
jozee@457
|
26 camera Digital Camera setup.
|
jozee@457
|
27 bluetooth Bluetooth setup.
|
jozee@457
|
28 3g-modem 3g-modem setup.
|
paul@549
|
29 firewall Start/stop firewall.
|
jozee@457
|
30 nvidia Nvidia (non-free/free) setup.
|
gokhlayeh@497
|
31 ati ATI (non-free/free) setup.
|
gokhlayeh@497
|
32
|
jozee@457
|
33 \033[1mOptions: \033[0m
|
jozee@457
|
34 --non-free install non-free packages (nvidia, ati).
|
jozee@457
|
35 --suggested auto-install optional dependencies.
|
jozee@457
|
36 --confirm confirm before installing optional dependencies\n"
|
jozee@457
|
37 }
|
jozee@457
|
38
|
jozee@457
|
39
|
jozee@457
|
40 run_daemon_startup()
|
jozee@457
|
41 {
|
jozee@457
|
42 # Add server to rcS.conf and avoid duplication.
|
jozee@457
|
43 . /etc/rcS.conf
|
jozee@457
|
44 if ! echo "$RUN_DAEMONS" | grep -q "$1"; then
|
jozee@457
|
45 sed -i "s/^RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"\1 $1\"/" /etc/rcS.conf
|
gokhlayeh@497
|
46 fi
|
jozee@457
|
47 }
|
jozee@457
|
48
|
jozee@457
|
49 device()
|
jozee@457
|
50 {
|
jozee@457
|
51 case "$DEVICE" in
|
gokhlayeh@497
|
52 printer)
|
jozee@489
|
53 DEPENDS="$DEPENDS cups cups-pdf usbutils hal-info ghostscript aspell aspell-en"
|
jozee@457
|
54 SUGGESTED="hplip gutenprint foomatic-filters foomatic-db hal-cups-utils foomatic-db-nonfree ufr2 splix"
|
jozee@457
|
55 CONFIRM_SUGGESTED="yes"
|
gokhlayeh@497
|
56 GROUP="lp"
|
jozee@457
|
57 ;;
|
gokhlayeh@497
|
58 scanner)
|
jozee@460
|
59 DEPENDS="$DEPENDS xsane usbutils hal-info"
|
jozee@457
|
60 SUGGESTED="hplip"
|
jozee@457
|
61 GROUP="scanner lp"
|
jozee@457
|
62 ;;
|
jozee@457
|
63 webcam)
|
jozee@460
|
64 DEPENDS="$DEPENDS v4l-dvb usbutils hal-info"
|
jozee@457
|
65 SUGGESTED="xorg-xf86-video-v4l linux-video libv4l "
|
jozee@457
|
66 GROUP="video audio lp"
|
gokhlayeh@497
|
67 ;;
|
gokhlayeh@497
|
68 camera)
|
jozee@460
|
69 DEPENDS="$DEPENDS gphoto2 usbutils hal-info"
|
jozee@457
|
70 SUGGESTED=""
|
jozee@457
|
71 GROUP="camera lp"
|
jozee@457
|
72 ;;
|
jozee@457
|
73 bluetooth)
|
jozee@484
|
74 DEPENDS="$DEPENDS bluez usbutils hal-info pygobject dbus-python"
|
jozee@457
|
75 SUGGESTED=""
|
jozee@457
|
76 GROUP="lp"
|
gokhlayeh@497
|
77 ;;
|
jozee@457
|
78 3g-modem)
|
jozee@460
|
79 DEPENDS="$DEPENDS linux-dialup wvdial pcmciautils usbutils hal-info"
|
jozee@457
|
80 SUGGESTED=""
|
jozee@457
|
81 GROUP="dialout lp"
|
jozee@457
|
82 ;;
|
jozee@457
|
83 firewall)
|
jozee@457
|
84 DEPENDS="iptables slitaz-tools"
|
jozee@457
|
85 SUGGESTED="nmap"
|
jozee@457
|
86 GROUP=""
|
jozee@457
|
87 ;;
|
jozee@457
|
88 nvidia)
|
jozee@457
|
89 DEPENDS="mesa mesa-demos linux-agp xorg-xf86-video-nv"
|
jozee@457
|
90 NON_FREE_DEPENDS="mesa mesa-demos linux-agp nvidia"
|
jozee@457
|
91 SUGGESTED=""
|
gokhlayeh@497
|
92 GROUP="video"
|
jozee@457
|
93 ;;
|
jozee@457
|
94 ati)
|
jozee@459
|
95 DEPENDS=" xorg-xf86-video-ati mesa-dri-ati mesa-demos"
|
jozee@457
|
96 NON_FREE_DEPENDS="mesa mesa-demos mesa-dri linux-agp catalyst"
|
jozee@457
|
97 SUGGESTED=""
|
gokhlayeh@497
|
98 GROUP="video"
|
gokhlayeh@497
|
99 ;;
|
jozee@457
|
100 esac
|
jozee@457
|
101 }
|
jozee@457
|
102
|
gokhlayeh@497
|
103 # Check if user is root
|
jozee@457
|
104 check_root()
|
jozee@457
|
105 {
|
jozee@457
|
106 if test $(id -u) != 0 ; then
|
jozee@457
|
107 echo -e "\nYou must be root to run `basename $0` with this option."
|
jozee@457
|
108 echo -e "Please use 'su' and root password to become super-user.\n"
|
jozee@457
|
109 exit 0
|
jozee@457
|
110 fi
|
jozee@457
|
111 }
|
jozee@457
|
112
|
jozee@457
|
113 untested()
|
jozee@457
|
114 {
|
jozee@457
|
115 echo "=========================================================="
|
jozee@457
|
116 echo "Due to a lack of compatible hardware for troubleshooting,"
|
jozee@457
|
117 echo "this $DEVICE device has not been properly tested. Please "
|
jozee@457
|
118 echo "report any success, failure, bug to SliTaz Labs or Forums."
|
jozee@457
|
119 echo "=========================================================="
|
jozee@457
|
120 sleep 1
|
jozee@457
|
121 }
|
jozee@457
|
122
|
jozee@457
|
123 failed()
|
jozee@457
|
124 {
|
jozee@457
|
125 echo ""
|
jozee@457
|
126 echo "======================================"
|
jozee@457
|
127 echo " Failed to setup $DEVICE"
|
jozee@457
|
128 echo "======================================"
|
jozee@457
|
129 sleep 1
|
jozee@457
|
130 }
|
jozee@457
|
131 # Install DEPENDS and/or SUGGESTED
|
jozee@457
|
132 install()
|
jozee@457
|
133 {
|
jozee@457
|
134 #echo "pkgs to install: $1"
|
jozee@457
|
135 for pkg in $1 ; do
|
jozee@457
|
136 # Avoid reinstall
|
jozee@457
|
137 if [ ! -d /var/lib/tazpkg/installed/"$pkg" ]; then
|
paul@549
|
138 echo "Installing pkg: $pkg"
|
jozee@457
|
139 tazpkg get-install "$pkg" --forced
|
gokhlayeh@497
|
140 if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then
|
jozee@457
|
141 UDEV_RULES="yes"
|
jozee@457
|
142 fi
|
jozee@457
|
143 fi
|
jozee@457
|
144 done
|
gokhlayeh@497
|
145
|
jozee@457
|
146 }
|
jozee@457
|
147 # Install DEPENDS and/or SUGGESTED
|
jozee@457
|
148 confirm_install()
|
jozee@457
|
149 {
|
jozee@457
|
150 #echo "Suggested pkgs to install: $1"
|
jozee@457
|
151 for pkg in $1 ; do
|
jozee@457
|
152 # Avoid reinstall
|
jozee@457
|
153 if [ ! -d /var/lib/tazpkg/installed/"$pkg" ]; then
|
paul@549
|
154 echo -n "Would you like to install pkg: $pkg (y/N) ? "; read anser
|
jozee@457
|
155 if [ "$anser" == "y" ]; then
|
jozee@457
|
156 tazpkg get-install "$pkg" --forced
|
gokhlayeh@497
|
157 if tazpkg list-files "$pkg" | grep -q "/etc/udev" ; then
|
jozee@457
|
158 UDEV_RULES="yes"
|
jozee@457
|
159 fi
|
gokhlayeh@497
|
160 fi
|
jozee@457
|
161 fi
|
gokhlayeh@497
|
162 done
|
jozee@457
|
163 }
|
jozee@457
|
164
|
jozee@457
|
165 add_all_user_to_group()
|
jozee@457
|
166 {
|
jozee@457
|
167 USERS=`grep /home /etc/passwd | cut -d: -f1`
|
jozee@457
|
168 #echo "checking $USERS in $GROUP"
|
jozee@457
|
169 for grp in $GROUP ; do
|
jozee@457
|
170 for user in $USERS ; do
|
jozee@457
|
171 if ! grep -q "$grp.*$user.*" /etc/group ; then
|
jozee@457
|
172 echo "adding $user to $grp"
|
jozee@457
|
173 addgroup "$user" "$grp"
|
gokhlayeh@497
|
174 fi
|
jozee@457
|
175 done
|
jozee@457
|
176 done
|
jozee@457
|
177 }
|
jozee@457
|
178
|
jozee@457
|
179 find_usb_device()
|
jozee@457
|
180 {
|
jozee@457
|
181 case "$DEVICE" in
|
jozee@457
|
182 printer) PATTERN="Cls=00" ;;
|
jozee@457
|
183 scanner) PATTERN="Cls=00" ;;
|
jozee@457
|
184 camera) PATTERN="Cls=00" ;;
|
jozee@457
|
185 bluetooth) PATTERN="Cls=e0" ;;
|
jozee@457
|
186 esac
|
gokhlayeh@497
|
187
|
gokhlayeh@497
|
188 if [ -f /proc/bus/usb/devices ]; then
|
jozee@457
|
189 # no vendor entry in dmesg ??
|
jozee@457
|
190 #dmesglogs=`dmesg | tail -20`
|
jozee@457
|
191 DETECTED="no"
|
jozee@457
|
192 count=1
|
gokhlayeh@497
|
193
|
jozee@457
|
194 # assume device to be in last 3 entries; use tac
|
jozee@457
|
195 DEVICES_LIST=`cat /proc/bus/usb/devices | grep ^[TDP] | grep -B1 -A1 "$PATTERN" | grep -i vendor | \
|
jozee@457
|
196 awk ' { print $2,$3 } ' | sed 's/ / /'|sed 's/Vendor=//' | sed 's/ProdID=//' | tail -3`
|
jozee@457
|
197 echo "Detected USB Device : Vendor : Product"
|
jozee@457
|
198 echo "========================================"
|
gokhlayeh@497
|
199 echo "$DEVICES_LIST" | while read line
|
jozee@457
|
200 do
|
jozee@457
|
201 vendorid=`echo "$line" | awk '{ print $1 }'`
|
pascal@520
|
202 [ -n "$vendorid" ] || continue
|
jozee@457
|
203 productid=`echo "$line" | awk '{ print $2 }'`
|
jozee@457
|
204 vendor=`zcat /usr/share/misc/usb.ids.gz | grep $vendorid | head -1`
|
jozee@457
|
205 product=`zcat /usr/share/misc/usb.ids.gz | grep $productid | head -2 | awk ' { print $1,$2,$3,$4} ' | sed -e :a -e '$!N;s/\n/ ; /;ta' `
|
jozee@457
|
206 echo " $count) Vendor : $vendor "
|
jozee@457
|
207 echo " Product : $product"
|
jozee@457
|
208 echo "========================================"
|
gokhlayeh@497
|
209 count=`expr $count + 1`
|
gokhlayeh@497
|
210 done
|
jozee@457
|
211 # confirm (use dmesg or some other way to automate this)
|
gokhlayeh@497
|
212 confirm_device
|
jozee@457
|
213 fi
|
jozee@457
|
214 }
|
jozee@457
|
215
|
jozee@457
|
216 confirm_device()
|
jozee@457
|
217 {
|
paul@549
|
218 echo -n "Which no. is your $DEVICE shown in the above lines (1,2,3,none); ? "; read choice
|
gokhlayeh@497
|
219
|
jozee@457
|
220 case "$choice" in
|
jozee@457
|
221 [nN*]) DETECTED="no" ;;
|
gokhlayeh@497
|
222
|
jozee@457
|
223 *) dev=`echo "$DEVICES_LIST" | head -$choice | tail -1`
|
jozee@457
|
224 vendorid=`echo "$dev" | awk '{ print $1 }'`
|
jozee@457
|
225 productid=`echo "$dev" | awk '{ print $2 }'`
|
jozee@457
|
226 bus=`grep -B2 ".*$vendorid.*$productid" /proc/bus/usb/devices| grep Bus`
|
jozee@457
|
227 busno=` echo $bus| awk '{ print $2 }' |cut -d "=" -f 2`
|
gokhlayeh@497
|
228 deviceno=`echo $bus| awk '{ print $8 }' `
|
jozee@457
|
229 HP=`echo $vendor | grep -q -i "Hewlett"`
|
gokhlayeh@497
|
230 DETECTED="yes"
|
jozee@457
|
231 ;;
|
jozee@457
|
232 esac
|
gokhlayeh@497
|
233
|
gokhlayeh@497
|
234
|
jozee@457
|
235 }
|
jozee@457
|
236
|
jozee@457
|
237 hputil()
|
jozee@457
|
238 {
|
gokhlayeh@497
|
239 if [ "$HP" == "1" ]; then
|
jozee@457
|
240 install "hplip"
|
jozee@457
|
241 echo ""
|
paul@549
|
242 echo -n "Do you want to use hp-setup utility (y/N) ? "; read choice
|
jozee@457
|
243 if [ "$choice" == "y" ]; then
|
jozee@457
|
244 hp-setup
|
jozee@457
|
245 fi
|
gokhlayeh@497
|
246 fi
|
jozee@457
|
247 }
|
jozee@457
|
248
|
jozee@457
|
249 # udev now should do this correctly
|
jozee@457
|
250 fix_usb_permissions()
|
jozee@457
|
251 {
|
jozee@457
|
252 grp=$1
|
jozee@457
|
253 if [ "$DETECTED" == "yes" ]; then
|
jozee@457
|
254 if ls /dev/bus/usb/*$busno/*$deviceno ; then
|
jozee@457
|
255 chmod 666 /dev/bus/usb/*$busno/*$deviceno
|
jozee@457
|
256 chgrp $grp /dev/bus/usb/*$busno/*$deviceno
|
gokhlayeh@497
|
257 echo "========================================"
|
jozee@457
|
258 echo -e "\033[1m Verify $DEVICE Permissions \033[0m "
|
paul@549
|
259 echo "Your $DEVICE must be in $grp group with 666 permissions"
|
gokhlayeh@497
|
260 ls -l /dev/bus/usb/*$busno/*$deviceno
|
gokhlayeh@497
|
261 echo "========================================"
|
jozee@457
|
262 fi
|
gokhlayeh@497
|
263 fi
|
gokhlayeh@497
|
264
|
jozee@457
|
265 }
|
jozee@457
|
266
|
jozee@457
|
267 fix_parallel_permissions()
|
jozee@457
|
268 {
|
jozee@457
|
269 if [ -f /usr/lib/cups/backend/parallel ] ; then
|
gokhlayeh@497
|
270 chmod 0755 /usr/lib/cups/backend/parallel
|
jozee@457
|
271 fi
|
jozee@457
|
272 }
|
jozee@457
|
273
|
jozee@457
|
274 load_modules()
|
jozee@457
|
275 {
|
jozee@457
|
276 tazhw detect-pci
|
gokhlayeh@497
|
277 tazhw detect-usb
|
jozee@457
|
278 sleep 1
|
jozee@457
|
279 }
|
jozee@457
|
280
|
jozee@457
|
281 udev()
|
jozee@457
|
282 {
|
gokhlayeh@497
|
283
|
jozee@457
|
284 if [ "$UDEV_RULES" == "yes" ]; then
|
paul@549
|
285 echo "New udev rules are added by a package"
|
jozee@457
|
286 udevadm trigger
|
jozee@457
|
287 sleep 2
|
jozee@457
|
288 fi
|
gokhlayeh@497
|
289
|
jozee@457
|
290 }
|
jozee@457
|
291
|
jozee@457
|
292 xorg()
|
jozee@457
|
293 {
|
gokhlayeh@497
|
294
|
gokhlayeh@497
|
295 [ -x /usr/bin/Xorg ] || install "xorg"
|
jozee@457
|
296 echo "Auto configuring Xorg.."
|
jozee@457
|
297 # Xorg auto configuration.
|
gokhlayeh@497
|
298 if [ ! -d /etc/X11/xorg.conf.d -a -x /usr/bin/Xorg ]; then
|
jozee@457
|
299 echo "Configuring Xorg..."
|
gokhlayeh@497
|
300 # Populate /etc/X11/xorg.conf.d if it doesn't exist.
|
jozee@457
|
301 sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
|
jozee@457
|
302 sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
|
jozee@457
|
303 tazx config-xorg
|
jozee@457
|
304 fi
|
gokhlayeh@497
|
305
|
jozee@457
|
306 }
|
jozee@457
|
307
|
jozee@457
|
308 wvdialbox()
|
jozee@457
|
309 {
|
gokhlayeh@497
|
310 # setup your modem
|
gokhlayeh@497
|
311 #wvdialconf
|
jozee@457
|
312 echo "===================================="
|
jozee@457
|
313 #set username, password, pin
|
jozee@457
|
314 #echo -e "Edit \033[1m /etc/wvdial.conf \033[0m for phone number, login name, password and pin"
|
gokhlayeh@497
|
315 if [ ! -f /etc/wvdial.conf ]; then
|
jozee@457
|
316 APN="apn.yournet.net"
|
jozee@457
|
317 PHONE="*99#"
|
jozee@457
|
318 USERNAME="user"
|
jozee@457
|
319 PASSWORD="passwd"
|
jozee@457
|
320 PIN="9999"
|
jozee@457
|
321 echo "[Dialer slitaz]" > /etc/wvdial.conf
|
jozee@457
|
322 echo "Phone = $PHONE" >> /etc/wvdial.conf
|
jozee@457
|
323 echo "Username = $USERNAME" >> /etc/wvdial.conf
|
jozee@457
|
324 echo "Password = $PASSWORD" >> /etc/wvdial.conf
|
jozee@457
|
325 echo "Stupid Mode = 1" >> /etc/wvdial.conf
|
jozee@457
|
326 echo "Dial Command = ATDT" >> /etc/wvdial.conf
|
jozee@457
|
327 [ -n "$MODEM" ] || MODEM="/dev/ttyUSB0"
|
jozee@457
|
328 echo "Modem = $MODEM" >> /etc/wvdial.conf
|
jozee@457
|
329 echo "Baud = 460800" >> /etc/wvdial.conf
|
jozee@457
|
330 echo "Init1 = ATZ " >> /etc/wvdial.conf
|
jozee@457
|
331 echo "Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" >> /etc/wvdial.conf
|
gokhlayeh@497
|
332 echo "Init3 = AT+CGDCONT=1,\"IP\", \"$APN\"" >> /etc/wvdial.conf
|
jozee@457
|
333 echo "ISDN = 0" >> /etc/wvdial.conf
|
jozee@457
|
334 echo "Modem Type = Analog Modem" >> /etc/wvdial.conf
|
jozee@457
|
335 echo "" >> /etc/wvdial.conf
|
jozee@457
|
336 echo "" >> /etc/wvdial.conf
|
jozee@457
|
337 echo "[Dialer pin]" >> /etc/wvdial.conf
|
jozee@457
|
338 echo "Modem = $MODEM" >> /etc/wvdial.conf
|
jozee@457
|
339 echo "Init4 = AT+CPIN=$PIN" >> /etc/wvdial.conf
|
jozee@457
|
340 fi
|
jozee@457
|
341 #<action>sed -i "s/^\[Dialer.*/[Dialer slitaz]/" /etc/wvdial.conf</action>
|
jozee@457
|
342 #DIALER=`grep Dialer /etc/wvdial.conf | sed \'2d\'|tr \"[]\" \" \"|cut -d \" \" -f 3`
|
jozee@457
|
343 #DIALER=`grep -B1 AT+CPIN /etc/wvdial.conf | sed \'2d\'|tr \"[]\" \" \"|cut -d \" \" -f 3`
|
gokhlayeh@497
|
344
|
jozee@457
|
345 MAIN_DIALOG="
|
jozee@457
|
346 <window title=\"Wvdial Box\" icon-name=\"applications-internet\">
|
jozee@457
|
347 <vbox>
|
gokhlayeh@497
|
348
|
jozee@457
|
349 "
|
jozee@457
|
350 MAIN_DIALOG=${MAIN_DIALOG}'
|
gokhlayeh@497
|
351
|
jozee@457
|
352 <hbox>
|
jozee@457
|
353 <text use-markup="true">
|
jozee@457
|
354 <label>"<b>Phone Number: </b>"</label>
|
jozee@457
|
355 </text>
|
jozee@457
|
356 <entry>
|
jozee@457
|
357 <input>cat /etc/wvdial.conf | grep ^Phone | cut -d "=" -f2 | tr -d "[\" ]"</input>
|
jozee@457
|
358 <variable>PHONE</variable>
|
jozee@457
|
359 </entry>
|
jozee@457
|
360 </hbox>
|
jozee@457
|
361 <hbox>
|
jozee@457
|
362 <text use-markup="true">
|
jozee@457
|
363 <label>"<b>Username: </b>"</label>
|
jozee@457
|
364 </text>
|
jozee@457
|
365 <entry>
|
jozee@457
|
366 <input>cat /etc/wvdial.conf | grep ^Username | cut -d "=" -f2 | tr -d "[\" ]"</input>
|
jozee@457
|
367 <variable>USERNAME</variable>
|
jozee@457
|
368 </entry>
|
jozee@457
|
369 </hbox>
|
jozee@457
|
370 <hbox>
|
jozee@457
|
371 <text use-markup="true">
|
jozee@457
|
372 <label>"<b>Password: </b>"</label>
|
jozee@457
|
373 </text>
|
jozee@457
|
374 <entry visibility="false">
|
jozee@457
|
375 <input>cat /etc/wvdial.conf | grep ^Password | cut -d "=" -f2 | tr -d "[\" ]"</input>
|
jozee@457
|
376 <variable>PASSWORD</variable>
|
jozee@457
|
377 </entry>
|
jozee@457
|
378 </hbox>
|
jozee@457
|
379 <hbox>
|
jozee@457
|
380 <text use-markup="true">
|
jozee@457
|
381 <label>"<b>Pin (if required):</b>"</label>
|
jozee@457
|
382 </text>
|
jozee@457
|
383 <entry visibility="false">
|
jozee@457
|
384 <input>cat /etc/wvdial.conf | grep AT+CPIN= | cut -d "=" -f3 | tr -d "[\" ]"</input>
|
jozee@457
|
385 <variable>PIN</variable>
|
jozee@457
|
386 </entry>
|
jozee@457
|
387 </hbox>
|
jozee@457
|
388 <hbox>
|
jozee@457
|
389 <text use-markup="true">
|
jozee@457
|
390 <label>"<b>Modem: </b>"</label>
|
jozee@457
|
391 </text>
|
jozee@457
|
392 <entry>
|
jozee@457
|
393 <input>cat /etc/wvdial.conf | grep ^Modem.*/dev.* | cut -d "=" -f2 | tr -d "[\" ]"|uniq</input>
|
jozee@457
|
394 <variable>MODEM</variable>
|
jozee@457
|
395 </entry>
|
jozee@457
|
396 </hbox>
|
jozee@457
|
397 <hbox>
|
jozee@457
|
398 <text use-markup="true">
|
jozee@457
|
399 <label>"<b>Access Point Name (APN):</b>"</label>
|
jozee@457
|
400 </text>
|
jozee@457
|
401 <entry>
|
jozee@457
|
402 <input>cat /etc/wvdial.conf | grep AT+CGDCONT | cut -d "," -f3 | tr -d "[\" ]"</input>
|
jozee@457
|
403 <variable>APN</variable>
|
jozee@457
|
404 </entry>
|
gokhlayeh@497
|
405 </hbox>
|
gokhlayeh@497
|
406
|
jozee@457
|
407
|
jozee@457
|
408 <hbox>
|
jozee@457
|
409 <text use-markup="true">
|
jozee@457
|
410 <label>"
|
jozee@457
|
411 <b>You must save your account info before dialing </b>"</label>
|
jozee@457
|
412 </text>
|
jozee@457
|
413 </hbox>
|
jozee@457
|
414 <hbox>
|
jozee@457
|
415 <button>
|
jozee@457
|
416 <label>/etc/wvdial.conf</label>
|
jozee@457
|
417 <input file icon="accessories-text-editor"></input>
|
jozee@457
|
418 <action>leafpad /etc/wvdial.conf</action>
|
jozee@457
|
419 <action>refresh:PHONE</action>
|
jozee@457
|
420 <action>refresh:USERNAME</action>
|
jozee@457
|
421 <action>refresh:PASSWORD</action>
|
jozee@457
|
422 <action>refresh:PIN</action>
|
jozee@457
|
423 <action>refresh:APN</action>
|
jozee@457
|
424 <action>refresh:MODEM</action>
|
jozee@457
|
425 </button>
|
jozee@457
|
426 <button>
|
jozee@457
|
427 <label>Save Configuration</label>
|
jozee@457
|
428 <input file icon="document-save"></input>
|
jozee@457
|
429 <action>sed -i "s/^Phone.*/Phone = $PHONE/ " /etc/wvdial.conf</action>
|
gokhlayeh@497
|
430 <action>sed -i "s/^Username.*/Username = $USERNAME/ " /etc/wvdial.conf</action>
|
gokhlayeh@497
|
431 <action>sed -i "s/^Password.*/Password = $PASSWORD/ " /etc/wvdial.conf</action>
|
jozee@457
|
432 <action>sed -i "s/.*AT+CPIN=.*/Init4 = AT+CPIN=$PIN/ " /etc/wvdial.conf</action>
|
gokhlayeh@497
|
433 <action>sed -i "s/.*AT+CGDCONT=.*/Init3 = AT+CGDCONT=1,\"IP\", \"$APN\" /" /etc/wvdial.conf </action>
|
gokhlayeh@497
|
434 <action>sed -i "s:^Modem.*/dev.*:Modem = $MODEM: " /etc/wvdial.conf</action>
|
jozee@457
|
435 </button>
|
gokhlayeh@497
|
436
|
jozee@457
|
437 </hbox>
|
gokhlayeh@497
|
438 <hbox>
|
jozee@457
|
439 <button>
|
jozee@457
|
440 <label>Dial Pin Once </label>
|
jozee@457
|
441 <input file icon="forward"></input>
|
gokhlayeh@497
|
442 <action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial pin; sleep 5"</action>
|
jozee@457
|
443 </button>
|
jozee@457
|
444 <button>
|
jozee@457
|
445 <label>Start Dialing </label>
|
jozee@457
|
446 <input file icon="forward"></input>
|
gokhlayeh@497
|
447 <action>xterm -geometry 80x16 -title "Wvdial" -e "echo \"Bringing eth0 down...\"; ifconfig eth0 down; ifconfig eth1 down; echo \"Dialing...\"; wvdial slitaz; sleep 5"</action>
|
jozee@457
|
448 </button>
|
gokhlayeh@497
|
449 </hbox> '
|
gokhlayeh@497
|
450
|
gokhlayeh@497
|
451
|
gokhlayeh@497
|
452 export MAIN_DIALOG=${MAIN_DIALOG}"
|
jozee@457
|
453 </vbox>
|
jozee@457
|
454 </window>"
|
gokhlayeh@497
|
455 gtkdialog --center --program=MAIN_DIALOG
|
jozee@457
|
456 }
|
jozee@457
|
457
|
jozee@457
|
458
|
jozee@457
|
459
|
jozee@457
|
460
|
jozee@457
|
461 setup()
|
jozee@457
|
462 {
|
gokhlayeh@497
|
463 case "$DEVICE" in
|
gokhlayeh@497
|
464 printer)
|
jozee@457
|
465 load_modules
|
jozee@457
|
466 udev
|
jozee@457
|
467 # check parallel or usb printer
|
jozee@457
|
468 if [ -f /proc/sys/dev/parport/parport*/autoprobe* ] ; then
|
jozee@457
|
469 fix_parallel_permissions
|
jozee@457
|
470 DETECTED="yes"
|
jozee@457
|
471 else
|
jozee@457
|
472 find_usb_device
|
jozee@457
|
473 fix_usb_permissions "lp"
|
jozee@457
|
474 fi
|
jozee@457
|
475 #lpinfo -v
|
jozee@457
|
476 if [ "$DETECTED" == "yes" ]; then
|
jozee@457
|
477 echo ""
|
paul@549
|
478 echo -n "Do you want to start cups (y/N) ? "; read anser
|
jozee@457
|
479 echo ""
|
jozee@457
|
480 if [ "$anser" == "y" ]; then
|
jozee@457
|
481 /etc/init.d/cupsd start
|
jozee@457
|
482 sleep 2
|
gokhlayeh@497
|
483 browser http://localhost:631/
|
gokhlayeh@497
|
484 else
|
jozee@457
|
485 echo ""
|
jozee@457
|
486 echo "===================================="
|
paul@549
|
487 echo -e "Starting \033[1m cups \033[0m using :"
|
jozee@457
|
488 echo "/etc/init.d/cupsd start"
|
jozee@457
|
489 echo "browser http://localhost:631/"
|
jozee@457
|
490 echo "===================================="
|
jozee@457
|
491 fi
|
jozee@457
|
492 else
|
jozee@457
|
493 failed
|
gokhlayeh@497
|
494 fi
|
jozee@457
|
495 ;;
|
gokhlayeh@497
|
496 scanner)
|
jozee@457
|
497 load_modules
|
jozee@457
|
498 udev
|
jozee@457
|
499 find_usb_device
|
gokhlayeh@497
|
500 fix_usb_permissions "scanner"
|
gokhlayeh@497
|
501
|
gokhlayeh@497
|
502 if [ "$DETECTED" == "yes" ]; then
|
gokhlayeh@497
|
503 #hputil
|
jozee@457
|
504 echo ""
|
paul@549
|
505 echo -n "Do you want to start scanner (y/N) ? "; read anser
|
jozee@457
|
506 echo ""
|
jozee@457
|
507 if [ "$anser" == "y" ]; then
|
jozee@457
|
508 sane-find-scanner # to verify scanner has been found
|
jozee@457
|
509 scanimage -L # List scanners
|
gokhlayeh@497
|
510 xsane #scanner application
|
gokhlayeh@497
|
511 else
|
jozee@457
|
512 echo ""
|
jozee@457
|
513 echo "===================================="
|
jozee@457
|
514 echo -e "Following \033[1m Scanner commands \033[0m may be of help"
|
jozee@457
|
515 echo "sane-find-scanner # to verify scanner has been found"
|
paul@725
|
516 echo "xsane # scanner application"
|
jozee@457
|
517 echo "===================================="
|
jozee@457
|
518 fi
|
jozee@457
|
519 else
|
jozee@457
|
520 failed
|
jozee@457
|
521 fi
|
jozee@457
|
522 ;;
|
gokhlayeh@497
|
523 webcam)
|
jozee@457
|
524 load_modules
|
jozee@457
|
525 udev
|
gokhlayeh@497
|
526
|
jozee@457
|
527 if [ -n "`ls /dev/video0`" ] ; then
|
jozee@457
|
528 # fix permissions
|
jozee@457
|
529 chmod 666 /dev/video0
|
gokhlayeh@497
|
530 # ls -l /dev/video0
|
gokhlayeh@497
|
531
|
jozee@457
|
532 if [ -d /var/lib/tazpkg/installed/mplayer-svn ]; then
|
jozee@457
|
533 echo ""
|
paul@549
|
534 echo -n "Would you like to test webcam (y/N) ? "; read anser
|
jozee@457
|
535 echo ""
|
jozee@457
|
536 if [ "$anser" == "y" ]; then
|
jozee@457
|
537 mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -vo x11 &
|
gokhlayeh@497
|
538 fi
|
jozee@457
|
539 else
|
jozee@457
|
540 echo ""
|
paul@549
|
541 echo -n "Would you like to test webcam by installing mplayer-svn (y/N) ? "; read anser
|
jozee@457
|
542 echo ""
|
jozee@457
|
543 if [ "$anser" == "y" ]; then
|
jozee@457
|
544 install mplayer-svn
|
jozee@457
|
545 mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -vo x11 &
|
gokhlayeh@497
|
546 else
|
jozee@457
|
547 echo ""
|
jozee@457
|
548 echo "============================"
|
paul@549
|
549 echo "Webcam is set up; please use mplayer-svn/fswebcam/amsn/skype to view"
|
jozee@457
|
550 echo "============================"
|
jozee@457
|
551 fi
|
jozee@457
|
552 fi
|
jozee@457
|
553 else
|
jozee@457
|
554 failed
|
jozee@457
|
555 fi
|
jozee@457
|
556 ;;
|
gokhlayeh@497
|
557 camera)
|
jozee@457
|
558 udev
|
jozee@457
|
559 find_usb_device
|
gokhlayeh@497
|
560 fix_usb_permissions "camera"
|
gokhlayeh@497
|
561
|
gokhlayeh@497
|
562 if [ "$DETECTED" == "yes" ]; then
|
jozee@457
|
563 echo ""
|
paul@549
|
564 echo -n "Do you want to check if gphoto2 can talk to your camera (y/N) ? "; read anser
|
jozee@457
|
565 echo ""
|
jozee@457
|
566 if [ "$anser" == "y" ]; then
|
jozee@457
|
567 # Show if the camera is detected
|
jozee@457
|
568 gphoto2 --auto-detect
|
paul@549
|
569 echo -e "Do you want to test importing photos (y/N) ? "; read choice
|
jozee@457
|
570 if [ "$choice" == "y" ]; then
|
jozee@457
|
571 mkdir -p ~/Images/Photos
|
jozee@457
|
572 cd ~/Images/Photos
|
jozee@457
|
573 gphoto2 --get-all-files
|
jozee@457
|
574 pcmanfm ~/Images/Photos
|
jozee@457
|
575 fi
|
jozee@457
|
576 echo ""
|
gokhlayeh@497
|
577 else
|
jozee@457
|
578 echo ""
|
jozee@457
|
579 echo "===================================="
|
paul@549
|
580 echo "Camera is set up; please use gphoto2 to import photos"
|
jozee@457
|
581 echo "Quick start guide: http://www.gphoto.org/doc/manual/using-gphoto2.html"
|
jozee@457
|
582 echo "===================================="
|
jozee@457
|
583 fi
|
jozee@457
|
584 else
|
jozee@457
|
585 failed
|
gokhlayeh@497
|
586 fi
|
jozee@457
|
587 ;;
|
gokhlayeh@497
|
588 bluetooth)
|
jozee@457
|
589 load_modules
|
jozee@457
|
590 udev
|
gokhlayeh@497
|
591
|
paul@549
|
592 echo -n "Do you want to see if the bluetooth is working (y/N) ? "; read anser
|
jozee@457
|
593 echo ""
|
jozee@457
|
594 if [ "$anser" == "y" ]; then
|
jozee@457
|
595 # sanity check: btusb is not loaded automagically for unknown reasons
|
gokhlayeh@497
|
596 if ! lsmod | grep -q btusb ; then
|
jozee@457
|
597 modprobe btusb
|
jozee@457
|
598 fi
|
gokhlayeh@497
|
599 echo "========================================"
|
jozee@457
|
600 echo -e "\033[1m Bluetooth \033[0m interfaces"
|
jozee@457
|
601 echo ""
|
jozee@457
|
602 lsusb | grep Bluetooth
|
jozee@457
|
603 # udev should run bluetoothd automatically
|
gokhlayeh@497
|
604 bluetoothd
|
jozee@484
|
605 sleep 1
|
jozee@484
|
606 if hcitool dev | grep -q hci ; then
|
gokhlayeh@497
|
607 echo "========================================"
|
jozee@484
|
608 echo -e "Following \033[1m Bluetooth commands \033[0m may be of help "
|
jozee@484
|
609 echo ""
|
jozee@484
|
610 #echo " modprobe btusb"
|
jozee@484
|
611 #echo " /usr/sbin/bluetoothd -nd #for starting bluetooth daemon"
|
jozee@484
|
612 echo " hciconfig -a"
|
gokhlayeh@497
|
613 echo " \"hcitool dev\" : checking local bluetooth devices..."
|
gokhlayeh@497
|
614 echo " \"hcitool scan\" : scanning remote bluetooth devices..."
|
gokhlayeh@497
|
615 echo " \"bluez-simple-agent\" : pairing with remote bluetooth devices..."
|
jozee@484
|
616 echo -e " You can manually edit the configuration files in \033[1m /etc/bluetooth \033[0m if need be"
|
gokhlayeh@497
|
617 echo "========================================"
|
jozee@484
|
618 fi
|
jozee@457
|
619 else
|
jozee@457
|
620 echo ""
|
gokhlayeh@497
|
621 echo "========================================"
|
jozee@457
|
622 echo -e "Following \033[1m Bluetooth commands \033[0m may be of help"
|
jozee@457
|
623 echo ""
|
jozee@457
|
624 echo " modprobe btusb"
|
jozee@457
|
625 echo " lsusb | grep Bluetooth"
|
paul@725
|
626 echo " /usr/sbin/bluetoothd -nd # for starting bluetooth daemon"
|
jozee@457
|
627 echo " hciconfig -a"
|
jozee@457
|
628 # Show if the bluetooth is detected
|
jozee@457
|
629 echo " hcitool dev # for checking local devices"
|
jozee@457
|
630 echo " hcitool scan # for scanning remote devices"
|
gokhlayeh@497
|
631 echo " bluez-simple-agent # pairing with remote bluetooth devices"
|
jozee@457
|
632 echo ""
|
paul@549
|
633 echo -e "You can manually edit the configuration files in \033[1m /etc/bluetooth \033[0m if need be"
|
gokhlayeh@497
|
634 echo ""
|
gokhlayeh@497
|
635 echo "========================================"
|
gokhlayeh@497
|
636 fi
|
jozee@457
|
637 ;;
|
gokhlayeh@497
|
638 3g-modem)
|
jozee@457
|
639 untested
|
jozee@457
|
640 load_modules
|
jozee@457
|
641 udev
|
jozee@457
|
642 echo ""
|
jozee@457
|
643 echo "===================================="
|
paul@549
|
644 echo "List detected devices"
|
jozee@457
|
645 # ls /dev/ttyUSB* /dev/ttyACM* /dev/modem
|
gokhlayeh@497
|
646
|
jozee@457
|
647 if [ -n "`ls /dev/ttyUSB*`" -o -n "`ls /dev/ttyACM*`" ] ; then
|
jozee@457
|
648 echo "Detected Modem at:"
|
jozee@457
|
649 echo "`ls /dev/ttyUSB*`"
|
paul@549
|
650 echo -n "Do you want to configure wvdial (y/N) ? "; read anser
|
jozee@457
|
651 echo ""
|
gokhlayeh@497
|
652 if [ "$anser" == "y" ]; then
|
gokhlayeh@497
|
653 wvdialbox
|
gokhlayeh@497
|
654 else
|
gokhlayeh@497
|
655 echo "===================================="
|
jozee@457
|
656 echo "wvdialconf"
|
jozee@457
|
657 echo -e "Edit \033[1m /etc/wvdial.conf \033[0m for phone number, login name, password and pin"
|
gokhlayeh@497
|
658 echo "wvdial dialername"
|
gokhlayeh@497
|
659 #nameserver `tail -30 /var/log/messages| grep DNS| sed 's/*\([.0-9]*\)$/\1/'` >/etc/resolv.conf
|
paul@549
|
660 echo -e "Add DNS adress of your provider in : \033[1m /etc/resolv.conf \033[0m "
|
gokhlayeh@497
|
661 echo "===================================="
|
jozee@457
|
662 fi
|
jozee@457
|
663 else
|
jozee@457
|
664 failed
|
gokhlayeh@497
|
665 fi
|
jozee@457
|
666 ;;
|
gokhlayeh@497
|
667 firewall) echo "Setting IPTABLES_RULES to yes in /etc/firewall.conf"
|
jozee@457
|
668 sed -i 's/^IPTABLES_RULES="no"/IPTABLES_RULES="yes"/' /etc/firewall.conf
|
jozee@457
|
669 # default is "start"
|
gokhlayeh@497
|
670 if [ "$STOP" == "yes" ] ; then
|
jozee@457
|
671 /etc/init.d/firewall stop
|
jozee@457
|
672 else
|
jozee@457
|
673 /etc/init.d/firewall start
|
jozee@457
|
674 if [ -d /var/lib/tazpkg/installed/nmap ]; then
|
gokhlayeh@497
|
675 echo "===================================="
|
gokhlayeh@497
|
676 echo "Probing for open ports..."
|
jozee@457
|
677 nmap localhost
|
gokhlayeh@497
|
678 echo "===================================="
|
jozee@457
|
679 fi
|
paul@549
|
680 echo "Adding firewall daemon to start automatically at boot"
|
jozee@457
|
681 run_daemon_startup "firewall"
|
gokhlayeh@497
|
682 echo "===================================="
|
gokhlayeh@497
|
683 fi
|
gokhlayeh@497
|
684
|
gokhlayeh@497
|
685 ;;
|
gokhlayeh@497
|
686 nvidia)
|
gokhlayeh@497
|
687 if [ "$NON_FREE" == "yes" ] ; then
|
gokhlayeh@497
|
688 if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-nv ]; then
|
gokhlayeh@497
|
689 rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
690 tazpkg remove xorg-xf86-video-nv
|
gokhlayeh@497
|
691 fi
|
gokhlayeh@497
|
692 load_modules
|
gokhlayeh@497
|
693 #xorg
|
paul@549
|
694 echo -n "Do you want to configure X using non-free nvidia driver (y/N) ? "; read anser
|
gokhlayeh@497
|
695 echo ""
|
gokhlayeh@497
|
696 if [ "$anser" == "y" ]; then
|
gokhlayeh@497
|
697 echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
|
gokhlayeh@497
|
698 echo "If nvidia fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
|
gokhlayeh@497
|
699 Xorg -configure :1 > /dev/null
|
gokhlayeh@497
|
700 nvidia-xconfig -c /root/xorg.conf.new -o /tmp/xorg.conf.nvidia
|
gokhlayeh@497
|
701 sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" /tmp/xorg.conf.nvidia > /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
702 rm /tmp/xorg.conf.nvidia /root/xorg.conf.new
|
gokhlayeh@497
|
703
|
gokhlayeh@497
|
704 if ! grep -q "NoLogo" /etc/X11/xorg.conf.d/55-DeviceTweaks.conf ; then
|
paul@549
|
705 echo "Adding to xorg.conf: Option \"NoLogo\" \"True\""
|
gokhlayeh@497
|
706 sed -i 's/BoardName\(.*\)/Boardname \1 \n Option "NoLogo" "True" /' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
jozee@457
|
707 fi
|
gokhlayeh@497
|
708
|
gokhlayeh@497
|
709 # mesa-demos to check if acceleration is working
|
gokhlayeh@497
|
710 echo "Checking if nvidia is working ..."
|
gokhlayeh@497
|
711 glxinfo |grep rendering
|
gokhlayeh@497
|
712
|
gokhlayeh@497
|
713 echo "================================"
|
gokhlayeh@497
|
714 echo -e "\033[1m Configure nvidia settings :\033[0m "
|
gokhlayeh@497
|
715 nvidia-settings
|
gokhlayeh@497
|
716 echo "================================"
|
gokhlayeh@497
|
717 else
|
jozee@457
|
718 echo ""
|
gokhlayeh@497
|
719 echo "================================"
|
gokhlayeh@497
|
720 echo "Use 'Xorg -configure :1 && nvidia-xconfig -c /root/xorg.conf.new -o /tmp/xorg.conf.nvidia' to generate a template configuration file."
|
gokhlayeh@497
|
721 echo "glxinfo |grep rendering # test nvidia"
|
gokhlayeh@497
|
722 echo "Use: nvidia-settings utility to configure your settings if necessary"
|
gokhlayeh@497
|
723 echo "Option \"NoLogo\" \"True\""
|
gokhlayeh@497
|
724 echo "================================"
|
gokhlayeh@497
|
725 fi
|
gokhlayeh@497
|
726 else
|
gokhlayeh@497
|
727 if [ -d /var/lib/tazpkg/installed/nvidia ]; then
|
gokhlayeh@497
|
728 rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
729 tazpkg remove nvidia
|
gokhlayeh@497
|
730 fi
|
gokhlayeh@497
|
731 load_modules
|
gokhlayeh@497
|
732 #xorg
|
paul@549
|
733 echo -n "Do you want to configure X using free nvidia driver (y/N) ? "; read anser
|
gokhlayeh@497
|
734 echo ""
|
gokhlayeh@497
|
735 if [ "$anser" == "y" ]; then
|
jozee@457
|
736 echo ""
|
gokhlayeh@497
|
737 echo "================================"
|
gokhlayeh@497
|
738 echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
|
gokhlayeh@497
|
739 echo "If nvidia fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
|
gokhlayeh@497
|
740 echo ""
|
gokhlayeh@497
|
741 echo "Create 55-DeviceTweaks.conf configured with nv driver."
|
gokhlayeh@497
|
742
|
gokhlayeh@497
|
743 # free nvidia driver is called nv
|
gokhlayeh@497
|
744 cp -a /etc/X11/xorg.conf.d/60-Device.conf /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
745 sed -i 's/vesa/nv/' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
746
|
gokhlayeh@497
|
747 # mesa-demos to check if acceleration is working
|
gokhlayeh@497
|
748 echo "Checking if nvidia is working ..."
|
gokhlayeh@497
|
749 glxinfo |grep rendering
|
gokhlayeh@497
|
750 echo "================================"
|
gokhlayeh@497
|
751 fi
|
gokhlayeh@497
|
752 fi
|
gokhlayeh@497
|
753 ;;
|
jozee@457
|
754 ati) untested
|
gokhlayeh@497
|
755 if [ "$NON_FREE" == "yes" ] ; then
|
gokhlayeh@497
|
756 if [ -d /var/lib/tazpkg/installed/xorg-xf86-video-ati ]; then
|
gokhlayeh@497
|
757 rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
758 tazpkg remove xorg-xf86-video-ati
|
gokhlayeh@497
|
759 fi
|
gokhlayeh@497
|
760 load_modules
|
gokhlayeh@497
|
761 #xorg
|
paul@549
|
762 echo -n "Do you want to configure X using non-free catalyst ati(radeon) driver (y/N) ? "; read anser
|
gokhlayeh@497
|
763 echo ""
|
gokhlayeh@497
|
764 if [ "$anser" == "y" ]; then
|
gokhlayeh@497
|
765 echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
|
gokhlayeh@497
|
766 echo "If ati fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
|
gokhlayeh@497
|
767
|
gokhlayeh@497
|
768 # add fglrx driver to xorg.conf
|
gokhlayeh@497
|
769 Xorg -configure :1 > /dev/null
|
gokhlayeh@497
|
770 aticonfig --initial --input=/root/xorg.conf.new --output=/tmp/xorg.conf.ati
|
gokhlayeh@497
|
771 sed -e '/Section "Device"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" /tmp/xorg.conf.ati > /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
772 rm /tmp/xorg.conf.ati /root/xorg.conf.new
|
gokhlayeh@497
|
773
|
gokhlayeh@497
|
774 # mesa-demos to check if acceleration is working
|
gokhlayeh@497
|
775 echo "Checking if ati catalyst is working ..."
|
gokhlayeh@497
|
776 glxinfo |grep rendering
|
gokhlayeh@497
|
777 else
|
jozee@457
|
778 echo ""
|
gokhlayeh@497
|
779 echo "================================"
|
gokhlayeh@497
|
780 echo -e "\033[1m Configuration :\033[0m "
|
gokhlayeh@497
|
781 echo "Use: aticonfig utility to generate a template configuration file if necessary"
|
gokhlayeh@497
|
782 echo "Xorg -configure :1 && aticonfig --initial --input=/root/xorg.conf.new --output=/tmp/xorg.conf.ati"
|
gokhlayeh@497
|
783 echo "restart xorg"
|
gokhlayeh@497
|
784 echo "glxinfo |grep rendering"
|
gokhlayeh@497
|
785 echo "================================"
|
gokhlayeh@497
|
786 fi
|
gokhlayeh@497
|
787 else
|
gokhlayeh@497
|
788 if [ -d /var/lib/tazpkg/installed/catalyst ]; then
|
gokhlayeh@497
|
789 rm /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
790 tazpkg remove catalyst
|
gokhlayeh@497
|
791 fi
|
gokhlayeh@497
|
792 load_modules
|
gokhlayeh@497
|
793 #xorg
|
paul@549
|
794 echo -n "Do you want to configure X using free ati (radeon) driver (y/N) ? "; read anser
|
gokhlayeh@497
|
795 echo ""
|
gokhlayeh@497
|
796 if [ "$anser" == "y" ]; then
|
jozee@457
|
797 echo ""
|
gokhlayeh@497
|
798 echo "================================"
|
gokhlayeh@497
|
799 echo "Your previous config is in /etc/X11/xorg.conf.d/60-Device.conf"
|
gokhlayeh@497
|
800 echo "If ati fails, you can remove /etc/X11/xorg.conf.d/55-DeviceTweaks.conf to restore previous config."
|
gokhlayeh@497
|
801 echo ""
|
gokhlayeh@497
|
802 echo "Create 55-DeviceTweaks.conf configured with radeon driver."
|
gokhlayeh@497
|
803
|
gokhlayeh@497
|
804 # free ati driver is called radeon
|
gokhlayeh@497
|
805 cp -a /etc/X11/xorg.conf.d/60-Device.conf /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
806 sed -i 's/vesa/nv/' /etc/X11/xorg.conf.d/55-DeviceTweaks.conf
|
gokhlayeh@497
|
807 # mesa-demos to check if acceleration is working
|
gokhlayeh@497
|
808 echo "Checking if ati radeon is working ..."
|
gokhlayeh@497
|
809 glxinfo |grep rendering
|
gokhlayeh@497
|
810 echo "================================"
|
gokhlayeh@497
|
811 fi
|
gokhlayeh@497
|
812 fi
|
gokhlayeh@497
|
813 ;;
|
jozee@457
|
814 esac
|
jozee@457
|
815 }
|
jozee@457
|
816
|
jozee@457
|
817 # What to do.
|
jozee@457
|
818 case "$1" in
|
jozee@457
|
819 help|usage ) usage ;;
|
jozee@457
|
820 wvdial) wvdialbox ;;
|
gokhlayeh@497
|
821 xorg) xorg;;
|
gokhlayeh@497
|
822
|
gokhlayeh@497
|
823 *) check_root
|
jozee@457
|
824 echo "COMMAND OPTIONS: $@"
|
jozee@457
|
825 for i in "$@"; do
|
gokhlayeh@497
|
826 if [ "$i" == "--non-free" ] ; then NON_FREE="yes"; fi
|
jozee@457
|
827 if [ "$i" == "--suggested" ] ; then AUTO_INSTALL_SUGGESTED="yes"; fi
|
gokhlayeh@497
|
828 if [ "$i" == "--confirm" ] ; then CONFIRM_SUGGESTED="yes"; fi
|
gokhlayeh@497
|
829 if [ "$i" == "stop" ] ; then STOP="yes"; fi
|
jozee@457
|
830 done
|
gokhlayeh@497
|
831
|
jozee@457
|
832 device
|
jozee@457
|
833 #untested
|
gokhlayeh@497
|
834 if [ ! "$NON_FREE_DEPENDS" == "" -a "$NON_FREE" == "yes" ]; then
|
gokhlayeh@497
|
835 DEPENDS="$NON_FREE_DEPENDS"
|
jozee@457
|
836 fi
|
jozee@457
|
837
|
jozee@457
|
838 if [ "$AUTO_INSTALL_SUGGESTED" == "yes" ]; then
|
jozee@457
|
839 anser="all"
|
jozee@457
|
840 elif [ "$CONFIRM_SUGGESTED" == "yes" ]; then
|
jozee@457
|
841 echo ""
|
jozee@457
|
842 echo "===================================="
|
paul@549
|
843 echo "The following optional packages can be installed:"
|
jozee@457
|
844 echo ""
|
jozee@457
|
845 echo "$SUGGESTED"
|
jozee@457
|
846 echo "===================================="
|
paul@549
|
847 echo -n "Do you want to install all/few/no optional dependencies (all|few|N) ? "; read anser
|
jozee@457
|
848 fi
|
gokhlayeh@497
|
849
|
jozee@457
|
850 install "$DEPENDS"
|
gokhlayeh@497
|
851 case $anser in
|
jozee@457
|
852 [aA]*|[yY]|1) install "$SUGGESTED" ;;
|
gokhlayeh@497
|
853 [fF]*|2) confirm_install "$SUGGESTED" ;;
|
jozee@457
|
854 *) ;;
|
jozee@457
|
855 esac
|
jozee@457
|
856
|
jozee@457
|
857 add_all_user_to_group
|
jozee@457
|
858 setup ;;
|
jozee@457
|
859 esac
|
jozee@457
|
860
|
jozee@457
|
861
|