wok diff syslinux/stuff/iso2exe/init @ rev 13697

syslinux/iso2exe: menu can create usbkey/floppy
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 14 15:43:12 2012 +0100 (2012-12-14)
parents 87a217af01ea
children db0eb389448c
line diff
     1.1 --- a/syslinux/stuff/iso2exe/init	Thu Dec 13 18:22:00 2012 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/init	Fri Dec 14 15:43:12 2012 +0100
     1.3 @@ -15,7 +15,7 @@
     1.4  gettazboot()
     1.5  {
     1.6  	echo "Creating $(basename $1) ..."
     1.7 -	O=$(($(get 36 /mnt/$ISO 2) - 0xE0))
     1.8 +	O=$(($(get 34 /mnt/$ISO 2) - 0xE0))
     1.9  	L=$((0x8000 - $(get 28 /mnt/$ISO 2) - $O))
    1.10  	S=$((32+$L))
    1.11  	P=$((($S+511)/512))
    1.12 @@ -157,7 +157,7 @@
    1.13  You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
    1.14  To uninstall SliTaz, you have only to remove this directory.
    1.15  The file \\boot.ini or \\config.sys may be modified too.\n\n
    1.16 -To do a traditional installation with disk partitioning -
    1.17 +To do a traditional installation with disk partitioning,
    1.18  start SliTaz Live with 'SliTaz RAM boot' menu.\n
    1.19  " 16 70
    1.20  	[ $? -eq 0 -a -x /usr/sbin/mount.posixovl ] || return
    1.21 @@ -172,7 +172,7 @@
    1.22  		--title " SliTaz bootloader for DOS " \
    1.23  		--yes-label "Install" --yesno \
    1.24  "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
    1.25 -a bzImage linux kernel, multiple initramfs', a kernel command line and
    1.26 +a bzImage linux kernel, multiple initramfs, a kernel command line and
    1.27  an ISO image file loopback (retrieves files from an ISO file).\n\n
    1.28  Usage: tazboot.exe [[@commands]|[kernel=<bzimage>] 
    1.29  [initrd=<rootfs>[,<rootfs2>...]] [iso=<isofile>] cmdline args ...]\n\n
    1.30 @@ -189,6 +189,142 @@
    1.31  	gettazboot /mnt/tazboot.exe
    1.32  }
    1.33  
    1.34 +md5()
    1.35 +{
    1.36 +	( cd /media/cdrom ; md5sum -c md5sum ) | tee /tmp/data
    1.37 +	$DIALOG --clear \
    1.38 +		--title " Checked files " \
    1.39 +		--textbox /tmp/data 24 78
    1.40 +	rm -f /tmp/data
    1.41 +}
    1.42 +
    1.43 +readme()
    1.44 +{
    1.45 +	$DIALOG --clear \
    1.46 +		--title " Readme " \
    1.47 +		--textbox /media/cdrom/README 24 78
    1.48 +}
    1.49 +
    1.50 +bootlog()
    1.51 +{
    1.52 +	$DIALOG --clear \
    1.53 +		--title " Linux boot messages " \
    1.54 +		--textbox /tmp/dmesg 24 78
    1.55 +}
    1.56 +
    1.57 +memtest()
    1.58 +{
    1.59 +	$DIALOG --clear \
    1.60 +		--title " Memtest86 " \
    1.61 +		--yes-label "Install" --yesno \
    1.62 +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
    1.63 +computers. BIOS based memory tests are a quick, cursory check and often
    1.64 +miss many of the failures that are detected by Memtest86.\n
    1.65 +" 12 70
    1.66 +	[ $? -eq 0 ] || return
    1.67 +	cp /media/cdrom/boot/memtest /mnt
    1.68 +}
    1.69 +
    1.70 +fdmemtest()
    1.71 +{
    1.72 +	$DIALOG --clear \
    1.73 +		--title " Create a Memtest86 boot floppy " \
    1.74 +		--yes-label "Create floppy" --yesno \
    1.75 +"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
    1.76 +computers. BIOS based memory tests are a quick, cursory check and often
    1.77 +miss many of the failures that are detected by Memtest86.\n\n
    1.78 +Please insert a blank disk in floppy drive.\n
    1.79 +" 12 70
    1.80 +	[ $? -eq 0 ] || return
    1.81 +	dd if=/media/cdrom/boot/memtest of=/dev/fd0
    1.82 +}
    1.83 +
    1.84 +gpxe()
    1.85 +{
    1.86 +	$DIALOG --clear \
    1.87 +		--title " SliTaz Web boot " \
    1.88 +		--yes-label "Install" --yesno \
    1.89 +"\nBoot your operating system from the internet and enjoy a full system
    1.90 +working entirely in RAM with speed and stability in mind. The Linux Kernel
    1.91 +and the complete SliTaz compressed root filesystem will be loaded into RAM
    1.92 +from the Web using PXE and HTTP protocols.\n
    1.93 +" 12 70
    1.94 +	[ $? -eq 0 ] || return
    1.95 +	cp /media/cdrom/boot/gpxe /mnt
    1.96 +}
    1.97 +
    1.98 +fdgpxe()
    1.99 +{
   1.100 +	$DIALOG --clear \
   1.101 +		--title " Create a SliTaz Web boot floppy " \
   1.102 +		--yes-label "Create floppy" --yesno \
   1.103 +"\nBoot your operating system from the internet and enjoy a full system
   1.104 +working entirely in RAM with speed and stability in mind. The Linux Kernel
   1.105 +and the complete SliTaz compressed root filesystem will be loaded into RAM
   1.106 +from the Web using PXE and HTTP protocols.\n\n
   1.107 +Please insert a blank disk in floppy drive.\n
   1.108 +" 12 70
   1.109 +	[ $? -eq 0 ] || return
   1.110 +	dd if=/media/cdrom/boot/gpxe of=/dev/fd0
   1.111 +}
   1.112 +
   1.113 +cdfile()
   1.114 +{
   1.115 +	[ -s /media/cdrom/$1 ] && echo -en "$2	${3// /.}"
   1.116 +}
   1.117 +
   1.118 +usbkey()
   1.119 +{
   1.120 +	$DIALOG --clear \
   1.121 +		--title " Create a SliTaz USB key " \
   1.122 +		--yes-label "Continue" --yesno \
   1.123 +"\nUnlike a hard drive install, the filesystem is kept in a compressed
   1.124 +rootfs.gz. The filesystem is loaded entirely into memory upon boot.
   1.125 +This should increase responsiveness, protect the filesystem against
   1.126 +accidental corruption and reduce read/writes to the USB drive.
   1.127 +Once setup, the tazusb utility can rewrite the root filesystem
   1.128 +with any changes you have made since booting up, 
   1.129 +giving the effective benefits of a hard drive install.\n\n
   1.130 +/home is mounted on boot using the UUID of your particular flash drive.
   1.131 +Unlike a device name, the UUID has the benefit of never changing from machine
   1.132 +to machine.\n\n
   1.133 +Please plug your USB stick in now.\n 
   1.134 +" 18 70
   1.135 +	[ $? -eq 0 ] || return
   1.136 +	DEV="$(grep -l 1 /sys/block/*/removable | \
   1.137 +		sed 's|/sys/block/\(.*\)/removable|\1|')"
   1.138 +	[ -n "$DEV" ] || return
   1.139 +	exec 3>&1
   1.140 +	sleep 5
   1.141 +	device=`$DIALOG  --clear \
   1.142 +	--title " Select your USB key " \
   1.143 +	--menu "\nPlease select the USB key according its known size.\n\n" \
   1.144 +	14 70 4 \
   1.145 +	$(for i in $DEV ; do
   1.146 +		echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB"	 
   1.147 +	done) \
   1.148 +	2>&1 1>&3`
   1.149 +	retval=$?
   1.150 +	exec 3>&-
   1.151 +	[ $retval -eq 0 ] || continue
   1.152 +	exec 3>&1
   1.153 +	format=`$DIALOG  --clear \
   1.154 +	--title " Select the filesystem " \
   1.155 +	--menu "\nPlease select the filesystem type to create.\n\n\
   1.156 +The filesystem creation will erase all the datas \
   1.157 +in the USB key." 14 70 4 \
   1.158 +		"none"	"Do not erase the USB key" \
   1.159 +		"ext3"	"Ext3 journaling filesystem" \
   1.160 +		"ext2"	"Ext2 filesystem" \
   1.161 +		"fat32"	"Window FAT32 filesystem" \
   1.162 +	2>&1 1>&3`
   1.163 +	retval=$?
   1.164 +	exec 3>&-
   1.165 +	[ $retval -eq 0 ] || continue
   1.166 +	[ "$format" != "none" ] && tazusb format $device "SliTaz" $format
   1.167 +	tazusb gen-iso2usb /mnt/$ISO $device
   1.168 +}
   1.169 +
   1.170  text()
   1.171  {
   1.172  	umount -d /media/cdrom
   1.173 @@ -220,9 +356,15 @@
   1.174  	/sbin/poweroff -f
   1.175  }
   1.176  
   1.177 +shell()
   1.178 +{
   1.179 +	/sbin/getty -n -l /bin/ash 38400 tty1
   1.180 +}
   1.181 +
   1.182  [ -x /usr/sbin/mount.posixovl ] ||
   1.183  mv /usr/sbin/mount.posixovl.iso2exe /usr/sbin/mount.posixovl
   1.184  mount -t proc /proc /proc
   1.185 +dmesg > /tmp/dmesg
   1.186  ISO="$(getarg iso | sed 's/.://;s|\\|/|g')"
   1.187  getiso
   1.188  case "$(basename $ISO | tr [A-Z] [a-z])$(getarg mode)" in
   1.189 @@ -235,14 +377,22 @@
   1.190  	exec 3>&1
   1.191  	value=`$DIALOG  --clear \
   1.192  	--title " Welcome to SliTaz " \
   1.193 -	--menu "\nPlease select" 15 70 7 \
   1.194 -		"live"		"SliTaz RAM boot" \
   1.195 -		"text"		"SliTaz RAM boot (text mode only)" \
   1.196 -		"install"	"Hard disk installation" \
   1.197 -		"tazboot"	"Get tazboot.exe Linux loader" \
   1.198 -		"reboot"	"Restart the computer" \
   1.199 -		"poweroff"	"Power off" \
   1.200 -		"ash"		"Shell prompt" \
   1.201 +	--menu "\nPlease select" 17 70 9 \
   1.202 +			"live"		"SliTaz RAM boot" \
   1.203 +			"text"		"SliTaz RAM boot (text mode only)" \
   1.204 +$(cdfile README		"readme"	"Show the README file") \
   1.205 +$(cdfile md5sum		"md5"		"Check ISO files") \
   1.206 +			"install"	"Hard disk installation" \
   1.207 +			"usbkey"	"USB key installation" \
   1.208 +			"tazboot"	"Get tazboot.exe Linux loader" \
   1.209 +$(cdfile Xboot/memtest	"memtest"	"Get Memtest86") \
   1.210 +$(cdfile boot/memtest	"fdmemtest"	"Create a Memtest86 boot floppy") \
   1.211 +$(cdfile Xboot/gpxe	"gpxe"		"Get SliTaz Web boot utility") \
   1.212 +$(cdfile boot/gpxe	"fdgpxe"	"Create a SliTaz Web boot floppy") \
   1.213 +			"reboot"	"Restart the computer" \
   1.214 +			"poweroff"	"Power off" \
   1.215 +			"bootlog"	"Linux boot messages" \
   1.216 +			"shell"		"Shell prompt" \
   1.217  	2>&1 1>&3`
   1.218  	retval=$?
   1.219  	exec 3>&-