slitaz-tools rev 656

tazinst: showurl+check commands added
author Dominique Corbex <domcox@slitaz.org>
date Mon Jul 25 12:03:18 2011 +0200 (2011-07-25)
parents b28d4a6bf467
children 9ec8aeb6a41f
files doc/tazinst.en.html installer/README installer/tazinst
line diff
     1.1 --- a/doc/tazinst.en.html	Wed Jul 20 15:29:22 2011 +0200
     1.2 +++ b/doc/tazinst.en.html	Mon Jul 25 12:03:18 2011 +0200
     1.3 @@ -72,32 +72,32 @@
     1.4  </ul>
     1.5  
     1.6  <ol>
     1.7 -	<li class="level1"><div class="li"> * INST_TYPE : the type of media containing
     1.8 +	<li class="level1"><div class="li"> * INST_TYPE: the type of media containing
     1.9  	the SliTaz source files, either: cdrom (SliTaz LiveCD), usb 
    1.10  	(SliTaz LiveUSB), iso (ISO image of SliTaz), web (ISO image on the Web), 
    1.11 -	weboot, ex : <code>INST_TYPE=web</code></div>
    1.12 +	weboot, ex: <code>INST_TYPE=web</code></div>
    1.13  	</li>
    1.14 -	<li class="level1"><div class="li"> * SRC_FILE : the name of the source file containing
    1.15 +	<li class="level1"><div class="li"> * SRC_FILE: the name of the source file containing
    1.16  	SliTaz. It depends on the type of support:
    1.17  	<ul>
    1.18 -	<li class="level2"><div class="li">cdrom (SliTaz LiveCD) : 
    1.19 +	<li class="level2"><div class="li">cdrom (SliTaz LiveCD): 
    1.20  	<i>unused</i></div>
    1.21  	</li>
    1.22 -	<li class="level2"><div class="li">usb (SliTaz LiveUSB) : name of the 
    1.23 -	partition on the host USB device, ex : <code>SRC_FILE=/dev/sdb1</code>
    1.24 +	<li class="level2"><div class="li">usb (SliTaz LiveUSB): name of the 
    1.25 +	partition on the host USB device, ex: <code>SRC_FILE=/dev/sdb1</code>
    1.26  	</div>
    1.27  	</li>
    1.28 -	<li class="level2"><div class="li">iso (ISO image of SliTaz) : name of the 
    1.29 -	ISO file, ex : <code>SRC_FILE=~/slitaz.3.0.iso</code></div>
    1.30 +	<li class="level2"><div class="li">iso (ISO image of SliTaz): name of the 
    1.31 +	ISO file, ex: <code>SRC_FILE=~/slitaz.3.0.iso</code></div>
    1.32  	</li>
    1.33 -	<li class="level2"><div class="li">web (ISO image on the Web) : name of the 
    1.34 -	URL, ex : <code>
    1.35 +	<li class="level2"><div class="li">web (ISO image on the Web): name of the 
    1.36 +	URL, ex: <code>
    1.37  	SRC_FILE=http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso</code>. 
    1.38 -	Note that 3 URLs are predefined: 'stable', 'cooking, 'rolling', ex : 
    1.39 +	Note that 3 URLs are predefined: 'stable', 'cooking, 'rolling', ex: 
    1.40  	<code>SRC_FILE=cooking</code> downloads the latest cooking available 
    1.41  	from the web</div>
    1.42  	</li>
    1.43 -	<li class="level2"><div class="li">weboot : <i>unused</i></div></li> 
    1.44 +	<li class="level2"><div class="li">weboot: <i>unused</i></div></li> 
    1.45  	</ul></div>
    1.46  	</li>
    1.47  </ol>
    1.48 @@ -109,22 +109,22 @@
    1.49  </ul>
    1.50  
    1.51  <ol>
    1.52 -	<li class="level1"><div class="li"> * TGT_PARTITION : the name of the target
    1.53 -	partition SliTaz will install to or update, ex : <code>TGT_PARTITION=
    1.54 +	<li class="level1"><div class="li"> * TGT_PARTITION: the name of the target
    1.55 +	partition SliTaz will install to or update, ex: <code>TGT_PARTITION=
    1.56  	/dev/hda3</code></div>
    1.57  	</li>
    1.58 -	<li class="level1"><div class="li">TGT_FS : if this variable is entered, the 
    1.59 +	<li class="level1"><div class="li">TGT_FS: if this variable is entered, the 
    1.60  	target partition will be formatted in the file system specified, otherwise 
    1.61 -	the partition will be cleaned and /home will be preserved, ex : <code>
    1.62 +	the partition will be cleaned and /home will be preserved, ex: <code>
    1.63  	TGT_FS=ext3</code></div>
    1.64  	</li>
    1.65 -	<li class="level1"><div class="li">TGT_HOME : this variable indicates if need 
    1.66 -	be, the name of the partition to receive the /home directory, ex : <code>
    1.67 +	<li class="level1"><div class="li">TGT_HOME: this variable indicates if need 
    1.68 +	be, the name of the partition to receive the /home directory, ex: <code>
    1.69  	TGT_HOME=/dev/hda5</code></div>
    1.70  	</li>
    1.71 -	<li class="level1"><div class="li">TGT_HOME_FS : if this variable is entered, 
    1.72 +	<li class="level1"><div class="li">TGT_HOME_FS: if this variable is entered, 
    1.73  	the home partition will be formatted in the file system specified, 
    1.74 -	ex : <code>TGT_HOME_FS=ext2</code></div>
    1.75 +	ex: <code>TGT_HOME_FS=ext2</code></div>
    1.76  	</li>
    1.77  </ol>
    1.78  
    1.79 @@ -135,19 +135,19 @@
    1.80  </ul>
    1.81  
    1.82  <ol>
    1.83 -	<li class="level1"><div class="li">TGT_HOSTNAME : name of the system, ex : <code>
    1.84 +	<li class="level1"><div class="li">TGT_HOSTNAME: name of the system, ex: <code>
    1.85  	TGT_HOSTNAME=hd-slitaz</code>, by default <code>TGT_HOSTNAME=slitaz</code>
    1.86  	</div>
    1.87  	</li>
    1.88 -	<li class="level1"><div class="li">TGT_ROOT_PWD : superuser password, ex : 
    1.89 +	<li class="level1"><div class="li">TGT_ROOT_PWD: superuser password, ex: 
    1.90  	<code>TGT_ROOT_PWD=toor</code>, by default <code>
    1.91  	TGT_ROOT_PWD=root</code></div>
    1.92  	</li>
    1.93 -	<li class="level1"><div class="li">TGT_USER : user name, 
    1.94 -	ex : <code>TGT_USER=toto</code>, by default <code>TGT_USER=tux</code></div>
    1.95 +	<li class="level1"><div class="li">TGT_USER: user name, 
    1.96 +	ex: <code>TGT_USER=toto</code>, by default <code>TGT_USER=tux</code></div>
    1.97  	</li>
    1.98 -	<li class="level1"><div class="li">TGT_USER_PWD : user password, 
    1.99 -	ex : <code>TGT_USER_PWD=titi</code>, by default 
   1.100 +	<li class="level1"><div class="li">TGT_USER_PWD: user password, 
   1.101 +	ex: <code>TGT_USER_PWD=titi</code>, by default 
   1.102  	<code>TGT_USER_PWD=tux</code></div>
   1.103  	</li>
   1.104  </ol>
   1.105 @@ -158,20 +158,14 @@
   1.106  </ul>
   1.107  
   1.108  <ol>
   1.109 -	<li>TGT_GRUB : install the GRUB bootloader (yes or no), ex : 
   1.110 +	<li>TGT_GRUB: install the GRUB bootloader (yes or no), ex: 
   1.111  		<code>TGT_GRUB=yes</code>, by default <code>TGT_GRUB=no</code>
   1.112  	</li>
   1.113 -	<li class="level1"><div class="li">TGT_MENU_PARTITION : name of the partition 
   1.114 -	where the GRUB configuration file is installed. Normally, this variable is not 
   1.115 -	set, it can be used if GRUB is installed to a dedicated partition, or in a 
   1.116 -	multi-os configuration, 
   1.117 -	ex : <code>TGT_MENU_PARTITION=/dev/hda4</code></div>
   1.118 -	</li>
   1.119 -	<li class="level1"><div class="li">TGT_WINBOOT : if this variable is entered, 
   1.120 +	<li class="level1"><div class="li">TGT_WINBOOT: if this variable is entered, 
   1.121  	it indicates the partition containing Windows© to implement a dual-boot. It can 
   1.122  	also be set to 'auto', in this case the dual-boot will be on the first partition 
   1.123  	Windows© detected, 
   1.124 -	ex : <code>TGT_WINBOOT=auto</code></div>
   1.125 +	ex: <code>TGT_WINBOOT=auto</code></div>
   1.126  	</li>
   1.127  </ol>
   1.128  
   1.129 @@ -204,6 +198,27 @@
   1.130  tazinst upgrade /var/lib/tazinst.conf
   1.131  </pre>
   1.132  
   1.133 +<a name="showurl"></a>
   1.134 +<h3>showurl</h3>
   1.135 +<p>Display the full URL of the predefined shortcuts: 'stable', 'cooking, 'rolling'.</p>
   1.136 +<p>You may overwrite these shortcuts in /etc/slitaz/tazinst.conf:</p>
   1.137 +<ul>
   1.138 +<li>URL_STABLE="http://mirror.slitaz.org/iso/stable/slitaz...." for 'stable'</li>
   1.139 +<li>URL_COOKING="http://mirror.slitaz.org/iso/cooking/slitaz..." for 'cooking'</li>
   1.140 +<li>URL_ROLLING="http://mirror.slitaz.org/iso/rolling/slitaz..." for 'rolling'</li>
   1.141 +</ul>
   1.142 +<pre>
   1.143 +tazinst showurl stable
   1.144 +</pre>
   1.145 +
   1.146 +<a name="check"></a>
   1.147 +<h3>check</h3>
   1.148 +<p>Check a configuration file for errors.</p>
   1.149 +<pre>
   1.150 +tazinst check /var/lib/tazinst.conf
   1.151 +</pre>
   1.152 +
   1.153 +
   1.154  <h2>MAINTAINERS</h2>
   1.155  <p>
   1.156  	Christophe Lincoln &lt;pankso at slitaz.org&gt; <br />
     2.1 --- a/installer/README	Wed Jul 20 15:29:22 2011 +0200
     2.2 +++ b/installer/README	Mon Jul 25 12:03:18 2011 +0200
     2.3 @@ -34,4 +34,4 @@
     2.4  
     2.5  $ make msgmerge
     2.6  
     2.7 -================================================================================
     2.8 \ No newline at end of file
     2.9 +================================================================================
     3.1 --- a/installer/tazinst	Wed Jul 20 15:29:22 2011 +0200
     3.2 +++ b/installer/tazinst	Mon Jul 25 12:03:18 2011 +0200
     3.3 @@ -1,5 +1,5 @@
     3.4  #!/bin/sh
     3.5 -# slitaz-installer - SliTaz GNU/Linux installer.
     3.6 +# tazinst - SliTaz GNU/Linux installer.
     3.7  #
     3.8  # So this is the SliTaz installer. The script starts with a
     3.9  # few main variables, then all the functions and then the 
    3.10 @@ -10,16 +10,16 @@
    3.11  # Authors : Christophe Lincoln <pankso@slitaz.org>
    3.12  #           Dominique Corbex <domcox@slitaz.org>
    3.13  #
    3.14 -# Exit codes
    3.15 +# Exit codes:
    3.16  # 1: Parameters error 
    3.17  # 2: Configuration file error
    3.18  # 3: Source error
    3.19  # 4: Cancelled by user
    3.20  # 5: Target partition error
    3.21 -# 6: No SliTaz system to upgrade found
    3.22 +# 6: SliTaz system to upgrade not found
    3.23  # 8: Internal error
    3.24  
    3.25 -VERSION=3.01
    3.26 +VERSION=3.10
    3.27  
    3.28  # Internationalization
    3.29  . /usr/bin/gettext.sh
    3.30 @@ -39,17 +39,22 @@
    3.31  URL_COOKING="http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso"
    3.32  URL_ROLLING="http://mirror.slitaz.org/iso/rolling/slitaz-core.iso"
    3.33  
    3.34 +# Config
    3.35 +[ -r /etc/slitaz/tazinst.conf ] && . /etc/slitaz/tazinst.conf
    3.36 +
    3.37  # Print a short help
    3.38  usage()
    3.39  {
    3.40  	echo -e "\n`gettext \"Tazinst - SliTaz installer - Version\"`: $VERSION\n"
    3.41  	echo -e "\033[1m`gettext \"Usage\"`:"
    3.42 -	echo -e "\033[0m `gettext \"tazinst [command] [config-file]\"`\n"
    3.43 +	echo -e "\033[0m `gettext \"tazinst [command] [config-file|url|options]\"`\n"
    3.44  	echo -e "\033[1m`gettext \"Commands\"`: \033[0m"
    3.45  	echo -e "usage         `gettext \"Print this short usage.\"`"
    3.46  	echo -e "install       `gettext \"Install SliTaz on HDD using a configuration file.\"`"
    3.47  	echo -e "upgrade       `gettext \"Upgrade SliTaz on HDD using a configuration file.\"`"
    3.48  	echo -e "config        `gettext \"Generate a configuration file.\"`"
    3.49 +	echo -e "check         `gettext \"Check configuration file validity.\"`"
    3.50 +	echo -e "showurl       `gettext \"Show the full URL of a predefined URL (stable|cooking|rolling).\"`"
    3.51  	echo -e "cli           `gettext \"Install or upgrade using command line options:\"`"
    3.52  	echo -e "  -i             `gettext \"Full Install (not upgrading, all present data will be lost).\"`"
    3.53  	echo -e "  -u             `gettext \"Upgrade (Needs an active internet connection).\"`"
    3.54 @@ -76,7 +81,7 @@
    3.55  		umount $TARGET_ROOT 2>>$LOG
    3.56  	fi
    3.57  	echo -e "`gettext \"Error\"` $@"
    3.58 -	echo -e "`gettext \"Installation cancelled\"`"
    3.59 +#	echo -e "`gettext \"Installation cancelled\"`"
    3.60  	test $(id -u) = 0 && echo "Installation cancelled on error $@" >> $LOG
    3.61  	exit $1
    3.62  }
    3.63 @@ -270,7 +275,7 @@
    3.64  
    3.65  	# Check Action
    3.66  	case $INST_ACTION in
    3.67 -		install|upgrade) ;;
    3.68 +		install|upgrade|check) ;;
    3.69  		*) msg `gettext "INST_ACTION=$INST_ACTION: Invalid setting"`; error=yes ;;
    3.70  	esac
    3.71  
    3.72 @@ -299,7 +304,7 @@
    3.73  				msg `gettext "SRC_FILE=$SRC_FILE: file not found"`; error=yes
    3.74  			fi ;;
    3.75  		web)
    3.76 -			if [ $(wget -sq "$SRC_FILE") ]; then
    3.77 +			if ! wget -sq "$SRC_FILE" 2> /dev/null ; then
    3.78  				msg `gettext "SRC_FILE=$SRC_FILE: file not found on the web"`; error=yes
    3.79  			fi ;;
    3.80  	esac
    3.81 @@ -766,7 +771,7 @@
    3.82  	[ -e /root/.xinitrc ] && cp /root/.xinitrc /home/$TGT_USER
    3.83  	mkdir -p /home/$TGT_USER/.config/slitaz
    3.84  	cp -a /etc/slitaz/applications.conf /home/$TGT_USER/.config/slitaz
    3.85 -	# chmod $TGT_USER:user doesn't work with most ISO
    3.86 +	# Set ownership
    3.87  	if grep -q ^users: /etc/group; then
    3.88  		chown -R $TGT_USER:users /home/$TGT_USER
    3.89  	else
    3.90 @@ -1262,6 +1267,22 @@
    3.91  				grub_install
    3.92  				end_of_install ;;
    3.93  		esac ;;
    3.94 +	showurl)
    3.95 +		case $2 in
    3.96 +			stable)
    3.97 +				echo $URL_STABLE ;;
    3.98 +			cooking)
    3.99 +				echo $URL_COOKING ;;
   3.100 +			rolling)
   3.101 +				echo $URL_ROLLING ;;
   3.102 +		esac ;;
   3.103 +	check)
   3.104 +		LOG="/dev/null"
   3.105 +		INST_ACTION=check
   3.106 +		check_root
   3.107 +		init $@
   3.108 +		read_configuration_file $2
   3.109 +		check_vars ;;
   3.110  	usage|*)
   3.111  		usage ;;
   3.112  esac