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

syslinux/iso2exe: check kernel version, add floppy bootstrap stub
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 28 11:51:42 2013 +0100 (2013-03-28)
parents 4bb9acf2b1b4
children 5ed4d6b2d690
line diff
     1.1 --- a/syslinux/stuff/iso2exe/init	Sun Mar 24 23:14:15 2013 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/init	Thu Mar 28 11:51:42 2013 +0100
     1.3 @@ -294,6 +294,67 @@
     1.4  	[ -s /media/cdrom/$1 ] && echo -en "$2	${3// /.}"
     1.5  }
     1.6  
     1.7 +fdbootstrap()
     1.8 +{
     1.9 +	sz=$(echo $(od -j 28 -N 1 -t u1 -An /mnt/$ISO))
    1.10 +	if [ 0$sz -eq 0 ]; then
    1.11 +		$DIALOG --clear \
    1.12 +			--title " No floppy bootstrap available " \
    1.13 +			--msgbox \
    1.14 +"\nThe floppy bootstrap code is not available in the ISO file.\n\n
    1.15 +Can't create the floppy.\n
    1.16 +" 9 70
    1.17 +	else
    1.18 +		$DIALOG --clear \
    1.19 +			--title " Create a floppy bootstrap " \
    1.20 +			--yes-label "Continue" --yesno \
    1.21 +"\nThe floppy will install a driver to access to the ISO file
    1.22 +on your hard disk and will emulate a CD-ROM during the boot process.\n\n 
    1.23 +Please insert a floppy in drive now.\n 
    1.24 +" 10 70
    1.25 +		[ $? -eq 0 ] || return
    1.26 +		dd if=/mnt/$ISO of=/dev/fd0 bs=1 count=$(($sz * 512)) \
    1.27 +			skip=$(( $(od -j 60 -N 4 -t u4 -An) - ($sz * 512) ))
    1.28 +		echo "$ISO" | dd of=/dev/fd0 bs=512 seek=1
    1.29 +	fi
    1.30 +}
    1.31 +
    1.32 +usbdev()
    1.33 +{
    1.34 +	sleep 5
    1.35 +	DEV="$(grep -l 1 /sys/block/*/removable | \
    1.36 +		sed 's|/sys/block/\(.*\)/removable|\1|')"
    1.37 +	[ -n "$DEV" ] || return
    1.38 +	exec 3>&1
    1.39 +	device=`$DIALOG  --clear \
    1.40 +	--title " Select your USB key " \
    1.41 +	--menu "\nPlease select the USB key according to its known size.\n\n" \
    1.42 +	14 70 4 \
    1.43 +	$(for i in $DEV ; do
    1.44 +		echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB"	 
    1.45 +	done) \
    1.46 +	2>&1 1>&3`
    1.47 +	retval=$?
    1.48 +	exec 3>&-
    1.49 +	[ $retval -eq 0 ]
    1.50 +}
    1.51 +
    1.52 +usbbootkey()
    1.53 +{
    1.54 +	$DIALOG --clear \
    1.55 +		--title " Create a USB boot key " \
    1.56 +		--yes-label "Continue" --yesno \
    1.57 +"\nThe USB key will be used like a CD-ROM. You will not be able to write
    1.58 +any data on it.\n\n
    1.59 +You should choose 'USB key read/write installation' to be
    1.60 +able to save the package updates or your own configuration and data files.\n\n
    1.61 +Please plug your USB stick in now.\n 
    1.62 +" 13 70
    1.63 +	[ $? -eq 0 ] || return
    1.64 +	usbdev || return
    1.65 +	dd if=/mnt/$ISO of=$device
    1.66 +}
    1.67 +
    1.68  usbkey()
    1.69  {
    1.70  	$DIALOG --clear \
    1.71 @@ -310,24 +371,9 @@
    1.72  Unlike a device name, the UUID has the benefit of never changing from machine
    1.73  to machine.\n\n
    1.74  Please plug your USB stick in now.\n 
    1.75 -" 18 70
    1.76 +" 19 70
    1.77  	[ $? -eq 0 -a -n "$(which tazusb)" ] || return
    1.78 -	sleep 5
    1.79 -	DEV="$(grep -l 1 /sys/block/*/removable | \
    1.80 -		sed 's|/sys/block/\(.*\)/removable|\1|')"
    1.81 -	[ -n "$DEV" ] || return
    1.82 -	exec 3>&1
    1.83 -	device=`$DIALOG  --clear \
    1.84 -	--title " Select your USB key " \
    1.85 -	--menu "\nPlease select the USB key according to its known size.\n\n" \
    1.86 -	14 70 4 \
    1.87 -	$(for i in $DEV ; do
    1.88 -		echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB"	 
    1.89 -	done) \
    1.90 -	2>&1 1>&3`
    1.91 -	retval=$?
    1.92 -	exec 3>&-
    1.93 -	[ $retval -eq 0 ] || continue
    1.94 +	usbdev || return
    1.95  	exec 3>&1
    1.96  	format=`$DIALOG  --clear \
    1.97  	--title " Select the filesystem " \
    1.98 @@ -341,7 +387,7 @@
    1.99  	2>&1 1>&3`
   1.100  	retval=$?
   1.101  	exec 3>&-
   1.102 -	[ $retval -eq 0 ] || continue
   1.103 +	[ $retval -eq 0 ] || return
   1.104  	[ "$format" != "none" ] && tazusb format $device "SliTaz" $format
   1.105  	tazusb gen-iso2usb /mnt/$ISO $device
   1.106  }
   1.107 @@ -427,13 +473,15 @@
   1.108  	exec 3>&1
   1.109  	value=`$DIALOG  --clear \
   1.110  	--title " Welcome to SliTaz " \
   1.111 -	--menu "\nPlease select" 17 70 9 \
   1.112 +	--menu "\nPlease select" 19 70 11 \
   1.113  			"live"		"SliTaz RAM boot" \
   1.114  			"text"		"SliTaz RAM boot (text mode only)" \
   1.115  $(cdfile README		"readme"	"Show the README file") \
   1.116  $(cdfile md5sum		"md5"		"Check ISO files") \
   1.117  			"install"	"Hard disk installation" \
   1.118 -			"usbkey"	"USB key installation" \
   1.119 +			"usbkey"	"USB key read/write installation" \
   1.120 +			"usbbootkey"	"USB boot key (read only)" \
   1.121 +			"fdbootstrap"	"Floppy bootstrap" \
   1.122  			"tazboot"	"Get tazboot.exe Linux loader" \
   1.123  $(cdfile Xboot/memtest	"memtest"	"Get Memtest86") \
   1.124  $(cdfile boot/memtest	"fdmemtest"	"Create a Memtest86 boot floppy") \