wok view slitaz-eeepc/stuff/tazeee @ rev 2922

Add: mysql-python (Python interface to MySQL)
author Claudinei Pereira <claudinei@slitaz.org>
date Wed May 06 23:28:27 2009 +0000 (2009-05-06)
parents 57a0f9506ece
children ba5bb45bb8fa
line source
1 #!/bin/sh
2 #
3 # Configure SliTaz for EeePC. Tazee prodide first boot initialisation
4 # to configure the EeePC model and a GTK box to have quick access to
5 # SliTaz EeePC stuff.
6 #
7 # 20090307 <pankso@slitaz.org> - GNU gpl v3.
8 #
9 : ${DIALOG=dialog}
11 check_root()
12 {
13 if test $(id -u) != 0 ; then
14 echo -e "\nYou must be root to run `basename $0` with this option."
15 echo -e "Please use 'su' and root password to become super-user.\n"
16 exit 0
17 fi
18 }
20 get_model()
21 {
22 EEEPC_MODEL=`dmidecode -s system-product-name`
23 echo "EeePC model detected: $EEEPC_MODEL"
24 # Create config file used at boot time by init script.
25 cat > /etc/eeepc.conf << _EOF_
26 # EeePC configuration file for SliTaz GNU/Linux.
27 #
28 EEEPC_MODEL="$EEEPC_MODEL"
29 _EOF_
30 }
32 # Specific model settings.
33 model_config()
34 {
35 . /etc/eeepc.conf
36 case $EEEPC_MODEL in
37 701)
38 SCREEN_SIZE='800x480x24'
39 HACK_915='5c 800 480 32'
40 KERNEL_MODULES='atl2 ath_pci'
41 WIFI_INTERFACE='ath0' ;;
42 900)
43 SCREEN_SIZE='1024x600x24'
44 HACK_915='54 1024 600 32'
45 KERNEL_MODULES='atl2 ath_pci'
46 WIFI_INTERFACE='ath0'
47 # Fix poweroff
48 echo 'rmmod snd_hda_intel' >> /etc/init.d/shutdown.sh ;;
49 901)
50 SCREEN_SIZE='1024x600x24'
51 HACK_915='54 1024 600 32'
52 KERNEL_MODULES='atl1e rt2860sta'
53 WIFI_INTERFACE='ra0' ;;
54 1000|1000H)
55 SCREEN_SIZE='1024x600x24'
56 HACK_915='54 1024 600 32'
57 KERNEL_MODULES='atl1e rt2860sta'
58 WIFI_INTERFACE='ra0' ;;
59 *)
60 echo "Skipping EeePC $EEEPC_MODEL setup..." && exit 0 ;;
61 esac
62 cat >> /etc/eeepc.conf << _EOF_
64 # Screen
65 SCREEN_SIZE="$SCREEN_SIZE"
66 HACK_915="$HACK_915"
68 # Network
69 KERNEL_MODULES="$KERNEL_MODULES"
70 WIFI_INTERFACE="$WIFI_INTERFACE"
71 _EOF_
72 }
74 # Load module now and add them to LOAD_MODULE for next boot if installed
75 # With this /etc/init.d/network.sh will start the wireless interface.
76 load_modules()
77 {
78 for mod in $KERNEL_MODULES
79 do
80 modprobe $mod
81 done
82 # Add module to rcS.conf and avoid duplication.
83 . /etc/rcS.conf
84 sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$LOAD_MODULES $KERNEL_MODULES\""/ \
85 /etc/rcS.conf
86 }
88 # Congig LXpanel.
89 config_wifi()
90 {
91 sed -i s/'iface=eth0'/"iface=$WIFI_INTERFACE"/ \
92 /etc/lxpanel/default/panels/panel
93 }
95 # Small GTKdialog box the have quick access to slitaz-eeepc stuff.
96 box()
97 {
98 export EEE_BOX='
99 <window title="SliTaz EeePC Box" icon-name="computer">
100 <vbox>
101 <vbox>
102 <pixmap>
103 <input file>/usr/share/images/eeepc-logo.png</input>
104 </pixmap>
105 <text>
106 <label>
107 "
108 Small interface to access SliTaz EeePC information and tools
109 "
110 </label>
111 </text>
112 </vbox>
113 <hbox>
114 <button>
115 <label>Documentation</label>
116 <input file icon="help"></input>
117 <action>firefox /usr/share/doc/slitaz-flavors/eeepc.html &</action>
118 </button>
119 <button>
120 <label>Show configuration</label>
121 <input file icon="computer"></input>
122 <action>leafpad /etc/eeepc.conf &</action>
123 </button>
124 <button>
125 <label>SSD/HDD install</label>
126 <input file icon="system-installer"></input>
127 <action>subox "xterm -e tazeee install" &</action>
128 </button>
129 <button>
130 <label>Exit</label>
131 <input file icon="exit"></input>
132 <action type="exit">exit</action>
133 </button>
134 </hbox>
135 </vbox>
136 </window>'
137 gtkdialog --center --program=EEE_BOX
138 }
140 case $1 in
141 setup)
142 check_root
143 get_model
144 model_config
145 load_modules
146 [ -n $WIFI_INTERFACE ] && config_wifi
147 echo "EeePC setup completed..." ;;
148 box)
149 box ;;
150 show-config)
151 echo ""
152 cat /etc/eeepc.conf
153 echo "" ;;
154 install)
155 # EeePC havn't got a cdrom so we must fake it.
156 echo ""
157 echo "Starting SliTaz EeePC installation..."
158 echo "Please do not reboot through the installer, just exit."
159 sleep 4
160 rmdir /media/cdrom
161 ln -s /home /media/cdrom
162 slitaz-installer
163 # Installer/GRUB see /dev/hdc1 as (hd2,0) --> we need (hd0,0)
164 mount /dev/hdc1 /mnt/target 2>/dev/null
165 if grep -q 'root=/dev/hdc1' /mnt/target/boot/grub/menu.lst 2>/dev/null; then
166 sed -i s/'(hd2,0)'/'(hd0,0)'/ /mnt/target/boot/grub/menu.lst
167 fi
168 umount /mnt/target 2>/dev/null
169 echo ""
170 echo "Installation completed. You can now reboot your EeePC"
171 echo "" ;;
172 *)
173 echo -e "\nUsage: `basename $0` [setup|box|show-config|install]\n" ;;
174 esac
176 exit 0