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