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

transmission-daemon: typo in receipt
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 05 12:02:40 2009 +0000 (2009-03-05)
parents 10d656b138ba
children 1d87b6c16397
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 # 20090301 <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 KERNEL_MODULES='atl2'
39 SCREEN_SIZE='800x480x24'
40 HACK_915='5c 800 480 32' ;;
41 901)
42 KERNEL_MODULES='atl1e rt2860sta'
43 SCREEN_SIZE='1024x600x24'
44 HACK_915='54 1024 600 32'
45 WIFI_INTERFACE='ra0' ;;
46 1000)
47 KERNEL_MODULES='atl1e rt2860sta'
48 WIFI_INTERFACE='ra0' ;;
49 *)
50 echo "Skipping EeePC $EEEPC_MODEL setup..." && exit 0 ;;
51 esac
52 cat >> /etc/eeepc.conf << _EOF_
54 # Screen
55 SCREEN_SIZE="$SCREEN_SIZE"
56 HACK_915="$HACK_915"
58 # Network
59 KERNEL_MODULES="$KERNEL_MODULES"
60 WIFI_INTERFACE="$WIFI_INTERFACE"
61 _EOF_
62 }
64 # Load module now and add them to LOAD_MODULE for next boot if installed
65 # With this /etc/init.d/network.sh will start the wireless interface.
66 load_modules()
67 {
68 for mod in $KERNEL_MODULES
69 do
70 modprobe $mod
71 done
72 # Add module to rcS.conf and avoid duplication.
73 . /etc/rcS.conf
74 sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$LOAD_MODULES $KERNEL_MODULES\""/ \
75 /etc/rcS.conf
76 }
78 # Active wifi interface it will be configured by network.sh and config
79 # LXpanel.
80 active_wifi()
81 {
82 sed -i s/'WIFI="no"'/'WIFI="yes"'/ /etc/network.conf
83 sed -i s/'iface=eth0'/"iface=$WIFI_INTERFACE"/ \
84 /etc/lxpanel/default/panels/panel
85 }
87 # Small GTKdialog box the have quick access to slitaz-eeepc stuff.
88 box()
89 {
90 export EEE_BOX='
91 <window title="SliTaz EeePC Box" icon-name="computer">
92 <vbox>
93 <vbox>
94 <pixmap>
95 <input file>/usr/share/images/eeepc-logo.png</input>
96 </pixmap>
97 <text>
98 <label>
99 "
100 Small interface to access SliTaz EeePC information and tools
101 "
102 </label>
103 </text>
104 </vbox>
105 <hbox>
106 <button>
107 <label>Documentation</label>
108 <input file icon="help"></input>
109 <action>firefox /usr/share/doc/slitaz-flavors/eeepc.html &</action>
110 </button>
111 <button>
112 <label>Show configuration</label>
113 <input file icon="computer"></input>
114 <action>leafpad /etc/eeepc.conf &</action>
115 </button>
116 <button>
117 <label>SSD/HDD install</label>
118 <input file icon="system-installer"></input>
119 <action>subox "xterm -e tazeee install" &</action>
120 </button>
121 <button>
122 <label>Exit</label>
123 <input file icon="exit"></input>
124 <action type="exit">exit</action>
125 </button>
126 </hbox>
127 </vbox>
128 </window>'
129 gtkdialog --center --program=EEE_BOX
130 }
132 case $1 in
133 setup)
134 check_root
135 get_model
136 model_config
137 load_modules
138 [ -n $WIFI_INTERFACE ] && active_wifi
139 echo "EeePC setup completed..." ;;
140 box)
141 box ;;
142 show-config)
143 echo ""
144 cat /etc/eeepc.conf
145 echo "" ;;
146 install)
147 # EeePC havn't got a cdrom so we must fake it.
148 echo ""
149 echo "Starting SliTaz EeePC installation..."
150 echo "Please do not reboot through the installer, just exit."
151 sleep 4
152 rmdir /media/cdrom
153 ln -s /home /media/cdrom
154 slitaz-installer
155 # Installer/GBUB see /dev/hdc1 as (hd2,0) --> we need (hd0,0)
156 mount /dev/hdc1 /mnt/target 2>/dev/null
157 if grep -q 'root=/dev/hdc1' /mnt/target/boot/grub/menu.lst 2>/dev/null; then
158 sed -i s/'(hd2,0)'/'(hd0,0)'/ /mnt/target/boot/grub/menu.lst
159 fi
160 umount /mnt/target 2>/dev/null
161 echo ""
162 echo "Installation completed. You can now reboot your EeePC"
163 echo "" ;;
164 *)
165 echo -e "\nUsage: `basename $0` [setup|box|show-config|install]\n" ;;
166 esac
168 exit 0