wok annotate slitaz-eeepc/stuff/tazeee @ rev 24984

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