slitaz-tools rev 612
tazinst: fix wrong permissions in /home and misc fixes
author | Dominique Corbex <domcox@slitaz.org> |
---|---|
date | Thu Jun 02 23:49:37 2011 +0200 (2011-06-02) |
parents | cbcf80d8f028 |
children | e1fb153cf45c |
files | installer/tazinst |
line diff
1.1 --- a/installer/tazinst Thu Jun 02 09:28:12 2011 -0300 1.2 +++ b/installer/tazinst Thu Jun 02 23:49:37 2011 +0200 1.3 @@ -8,9 +8,20 @@ 1.4 # (C) 2007-2011 SliTaz - GNU General Public License v3. 1.5 # 1.6 # Authors : Christophe Lincoln <pankso@slitaz.org> 1.7 -# 1.8 +# Dominique Corbex <domcox@slitaz.org> 1.9 1.10 -VERSION=2.99 1.11 +VERSION=2.991 1.12 + 1.13 +# Install tests (2011-06-01): 1.14 +# from iso ok 1.15 +# from web ok 1.16 +# stable-2.0 ok 1.17 +# stable-3.0 ok 1.18 +# cooking-20110329 ok 1.19 +# cooking-20110531 broken (xorg) 1.20 + 1.21 +# Upgrade tests: 1.22 +# 1.23 1.24 # 1.25 SOURCE_ROOT=/media/source 1.26 @@ -22,7 +33,7 @@ 1.27 DEBUG=0 1.28 1.29 # Mirror urls 1.30 -URL_STABLE="http://mirror.slitaz.org/iso/stable/slitaz-3.0.iso" 1.31 +URL_STABLE="http://mirror.slitaz.org/iso/stable/slitaz-4.0.iso" 1.32 URL_COOKING="http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso" 1.33 URL_ROLLING="http://mirror.slitaz.org/iso/rolling/slitaz-core.iso" 1.34 1.35 @@ -31,17 +42,17 @@ 1.36 { 1.37 echo -e "\n`gettext \"Tazinst - SliTaz installer - Version\"`: $VERSION\n" 1.38 echo -e "\033[1m`gettext \"Usage\"`:" 1.39 - echo -e "\033[0m `gettext \"tazinst [command] [config-file|options]\n\"`" 1.40 + echo -e "\033[0m `gettext \"tazinst [command] [config-file]\n\"`" 1.41 echo -e "\033[1m`gettext \"Commands\"`: \033[0m" 1.42 - echo -e "usage Print this short usage." 1.43 - echo -e "install Install SliTaz on HDD using a configuration file." 1.44 - echo -e "upgrade Upgrade SLiTaz on HDD using a configuration file." 1.45 - echo -e "config Generate a configuration file." 1.46 - echo -e "cli Install or upgrade using command line options:" 1.47 + echo -e "`gettext \"usage Print this short usage.\"`" 1.48 + echo -e "`gettext \"install Install SliTaz on HDD using a configuration file.\"`" 1.49 + echo -e "`gettext \"upgrade Upgrade SliTaz on HDD using a configuration file.\"`" 1.50 + echo -e "`gettext \"config Generate a configuration file.\"`" 1.51 + echo -e "`gettext \"cli Install or upgrade using command line options:\"`" 1.52 echo -e " -i `gettext \"Full Install (not upgrading, all present data will be lost).\"`" 1.53 echo -e " -u `gettext \"Upgrade (Needs an active internet connection).\"`" 1.54 echo -e " -t <type> `gettext \"Install type (cdrom|usb|iso|web|weboot).\"`" 1.55 - echo -e " -m <source> `gettext \"Source media (ex: file.iso|usb partition|web url)\"`" 1.56 + echo -e " -s <source> `gettext \"Source media (ex: file.iso|usb partition|web url)\"`" 1.57 echo -e " -p <partition> `gettext \"Partition where SliTaz will be installed (ex:/dev/hda3).\"`" 1.58 echo -e " -f <fs> `gettext \"Partition to be formatted (fs=ext2|ext3|ext4|etc..).\"`" 1.59 echo -e " -g `gettext \"Install Grub.\"`" 1.60 @@ -62,8 +73,8 @@ 1.61 if mount | grep -q $TARGET_ROOT; then 1.62 umount $TARGET_ROOT 2>>$LOG 1.63 fi 1.64 - echo "Error $@" 1.65 - echo "Installation cancelled" 1.66 + echo "`gettext \"Error\"` $@" 1.67 + echo "`gettext \"Installation cancelled\"`" 1.68 test $(id -u) = 0 && echo "Installation cancelled on error $@" >> $LOG 1.69 exit $1 1.70 } 1.71 @@ -71,7 +82,7 @@ 1.72 # Print a warning msg 1.73 warning() 1.74 { 1.75 - echo "Warning: $@" | tee -a $LOG 1.76 + echo "`gettext \"Warning:\"` $@" | tee -a $LOG 1.77 } 1.78 1.79 # Print a debug msg 1.80 @@ -161,14 +172,12 @@ 1.81 else 1.82 abort 2 "Configuration file $CONFILE not found" 1.83 fi 1.84 - 1.85 } 1.86 1.87 ###################### 1.88 # Checking functions # 1.89 ###################### 1.90 1.91 - 1.92 # def values and start log 1.93 # $@ : 1.94 init() 1.95 @@ -539,6 +548,9 @@ 1.96 prepare_install() 1.97 { 1.98 debug "Preparing target partition..." 1.99 + # Target may be used 1.100 + mount | grep -q $TGT_PARTITION && \ 1.101 + abort 5 $TGT_PARTITION": Partition in use" 1.102 # Mount point can be already used. 1.103 if mount | grep -q $TARGET_ROOT; then 1.104 umount $TARGET_ROOT 2>>$LOG 1.105 @@ -752,10 +764,10 @@ 1.106 echo "$TGT_USER:$TGT_USER_PWD" | chpasswd 1.107 if [ ! -d /home/$TGT_USER ]; then 1.108 cp -a /etc/skel /home/$TGT_USER 1.109 - cp /root/.xinitrc /home/$TGT_USER 1.110 + [ -e /root/.xinitrc ] && cp /root/.xinitrc /home/$TGT_USER 1.111 mkdir -p /home/$TGT_USER/.config/slitaz 1.112 cp -a /etc/slitaz/applications.conf /home/$TGT_USER/.config/slitaz 1.113 - chown -R $TGT_USER.users /home/$TGT_USER 1.114 + chown -R $TGT_USER:$TGT_USER /home/$TGT_USER 1.115 # Path for user desktop files. 1.116 for i in /home/$TGT_USER/.local/share/applications/*.desktop 1.117 do 1.118 @@ -842,7 +854,9 @@ 1.119 grub_config() 1.120 { 1.121 grub_partition 1.122 - win_partition 1.123 + if [ "$TGT_GRUB" == "yes" ]; then 1.124 + win_partition 1.125 + fi 1.126 # Create the target GRUB configuration. 1.127 mkdir -p $TARGET_ROOT/boot/grub 1.128 . /etc/locale.conf 1.129 @@ -870,7 +884,7 @@ 1.130 1.131 _EOF_ 1.132 if [ -n "$TGT_WINBOOT" ]; then 1.133 - cat >> $TARGET_ROOT/boot/grub/menu.lst << _EOF_ 1.134 + cat >> $TARGET_ROOT/boot/grub/menu.lst << _EOF_ 1.135 # For booting Windows : 1.136 # 1.137 title Microsoft Windows 1.138 @@ -909,7 +923,7 @@ 1.139 debug "Preconfiguring the system..." 1.140 pre_config_system 1.141 1.142 - msg "Configuring root and default $USER account..." 1.143 + msg "Configuring root and default $TGT_USER account..." 1.144 users_settings 1.145 1.146 if [ "$TGT_HOME" != "" ]; then 1.147 @@ -944,11 +958,6 @@ 1.148 # Copy log file, umount target and eject cdrom. 1.149 umount_devices() 1.150 { 1.151 - # Log files 1.152 - debug "Copying log files ($LOG)..." 1.153 - cp -a $LOG $TARGET_ROOT/var/log 1.154 - sleep 2 1.155 - 1.156 # Umount target 1.157 if mount | grep -q $TARGET_ROOT; then 1.158 echo "Unmounting target ($TGT_PARTITION)..." 1.159 @@ -975,6 +984,11 @@ 1.160 echo "Installation complete. You can now restart (reboot) \ 1.161 from your SliTaz GNU/Linux system." 1.162 echo "=== Tazinst end at `date` ===" >>$LOG 1.163 + # Log files 1.164 + echo "Copying log files ($LOG)..." 1.165 + cp -a $LOG $TARGET_ROOT/var/log 1.166 + sleep 2 1.167 + # umount 1.168 umount_devices 1.169 } 1.170 1.171 @@ -986,6 +1000,9 @@ 1.172 prepare_upgrade() 1.173 { 1.174 debug "Preparing the target partition..." 1.175 + # Target may be used 1.176 + mount | grep -q $TGT_PARTITION && \ 1.177 + abort 5 $TGT_PARTITION": Partition in use" 1.178 # Mount point can be already used. 1.179 if mount | grep -q $TARGET_ROOT; then 1.180 umount $TARGET_ROOT 2>>$LOG