wok-6.x view slitaz-eeepc/stuff/tazeee @ rev 18708

Up cookutils(786)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Dec 16 17:40:23 2015 +0200 (2015-12-16)
parents e7be6cf6d0eb
children
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|904|1000|1000H|E1210|U-100|U-110|U-115)
50 SCREEN_SIZE='1024x600x24'
51 HACK_915='54 1024 600 32'
52 KERNEL_MODULES='atl1e rt2860sta'
53 WIFI_INTERFACE='ra0' ;;
54 *)
55 echo "Skipping EeePC $EEEPC_MODEL setup..." && exit 0 ;;
56 esac
57 cat >> /etc/eeepc.conf << _EOF_
59 # Screen
60 SCREEN_SIZE="$SCREEN_SIZE"
61 HACK_915="$HACK_915"
63 # Network
64 KERNEL_MODULES="$KERNEL_MODULES"
65 WIFI_INTERFACE="$WIFI_INTERFACE"
66 _EOF_
67 }
69 # Load module now and add them to LOAD_MODULE for next boot if installed
70 # With this /etc/init.d/network.sh will start the wireless interface.
71 load_modules()
72 {
73 for mod in $KERNEL_MODULES
74 do
75 modprobe $mod
76 done
77 # Add module to rcS.conf and avoid duplication.
78 . /etc/rcS.conf
79 sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$LOAD_MODULES $KERNEL_MODULES\""/ \
80 /etc/rcS.conf
81 }
83 # Congig LXpanel.
84 config_wifi()
85 {
86 sed -i s/'iface=eth0'/"iface=$WIFI_INTERFACE"/ \
87 /etc/lxpanel/default/panels/panel
88 }
90 # Small GTKdialog box the have quick access to slitaz-eeepc stuff.
91 box()
92 {
93 export EEE_BOX='
94 <window title="SliTaz EeePC Box" icon-name="computer">
95 <vbox>
96 <vbox>
97 <pixmap>
98 <input file>/usr/share/images/eeepc-logo.png</input>
99 </pixmap>
100 <text>
101 <label>
102 "
103 Small interface to access SliTaz EeePC information and tools
104 "
105 </label>
106 </text>
107 </vbox>
108 <hbox>
109 <button>
110 <label>Documentation</label>
111 <input file icon="help"></input>
112 <action>firefox /usr/share/doc/slitaz-flavors/eeepc.html &</action>
113 </button>
114 <button>
115 <label>Show configuration</label>
116 <input file icon="computer"></input>
117 <action>leafpad /etc/eeepc.conf &</action>
118 </button>
119 <button>
120 <label>SSD/HDD install</label>
121 <input file icon="system-installer"></input>
122 <action>subox "xterm -e tazeee install" &</action>
123 </button>
124 <button>
125 <label>Exit</label>
126 <input file icon="exit"></input>
127 <action type="exit">exit</action>
128 </button>
129 </hbox>
130 </vbox>
131 </window>'
132 gtkdialog --center --program=EEE_BOX
133 }
135 case $1 in
136 setup)
137 check_root
138 get_model
139 model_config
140 load_modules
141 [ -n $WIFI_INTERFACE ] && config_wifi
142 echo "EeePC setup completed..." ;;
143 box)
144 box ;;
145 show-config)
146 echo ""
147 cat /etc/eeepc.conf
148 echo "" ;;
149 install)
150 # EeePC havn't got a cdrom so we must fake it.
151 echo ""
152 echo "Starting SliTaz EeePC installation..."
153 echo "Please do not reboot through the installer, just exit."
154 sleep 4
155 rmdir /media/cdrom
156 ln -s /home /media/cdrom
157 slitaz-installer
158 # Installer/GRUB see /dev/hdc1 as (hd2,0) --> we need (hd0,0)
159 mount /dev/hdc1 /mnt/target 2>/dev/null
160 if grep -q 'root=/dev/hdc1' /mnt/target/boot/grub/menu.lst 2>/dev/null; then
161 sed -i s/'(hd2,0)'/'(hd0,0)'/ /mnt/target/boot/grub/menu.lst
162 fi
163 umount /mnt/target 2>/dev/null
164 echo ""
165 echo "Installation completed. You can now reboot your EeePC"
166 echo "" ;;
167 *)
168 echo -e "\nUsage: `basename $0` [setup|box|show-config|install]\n" ;;
169 esac
171 exit 0