wok diff syslinux/stuff/iso2exe/taziso @ rev 24941

memtest: add binutils 2.37 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 16 12:43:33 2022 +0000 (2022-04-16)
parents 67e02e438fee
children 71e179a5ff9d
line diff
     1.1 --- a/syslinux/stuff/iso2exe/taziso	Mon Jan 03 17:58:48 2022 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/taziso	Sat Apr 16 12:43:33 2022 +0000
     1.3 @@ -1146,6 +1146,25 @@
     1.4  able to save the package updates or your own configuration and data files.\n\n"
     1.5  }
     1.6  
     1.7 +fixup_gpt()
     1.8 +{
     1.9 +	quads2bin 1 0 $2 0 | ddq bs=1 seek=$((512+24)) of=$1	# my gpt, alt gpt
    1.10 +	quads2bin 0 | ddq bs=1 seek=$((512+88)) of=$device
    1.11 +	quads2bin $(isohybrid --crc32 $1 1024 $(($(get 596 $1 4)*$(get 592 $1 4)))) | \
    1.12 +		ddq bs=1 seek=$((512+88)) of=$1			# CRC32 partitions
    1.13 +	ddn of=$1 if=$1 bs=512 skip=1 seek=$2 count=1
    1.14 +	ddn of=$1 if=$1 bs=512 skip=2 seek=$(($2-1)) count=1
    1.15 +	quads2bin $2 0 1 0 | ddq bs=1 seek=$(($2*512+24)) of=$1	# my gpt, alt gpt
    1.16 +	quads2bin $(($2-1)) 0 | ddq bs=1 seek=$(($2*512+72)) of=$1
    1.17 +	i=$(get 524 $1 4)
    1.18 +	quads2bin 0 | ddq bs=1 seek=$(($2*512+16)) of=$device
    1.19 +	quads2bin $(isohybrid --crc32 $1 $(($2*512)) $i) | \
    1.20 +		ddq bs=1 seek=$(($2*512+16)) of=$1	# CRC32 header
    1.21 +	quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
    1.22 +	quads2bin $(isohybrid --crc32 $1 512 $i) | ddq bs=1 seek=$((512+16)) of=$1	# CRC32 header
    1.23 +	partprobe $1
    1.24 +}
    1.25 +
    1.26  usbbootkey()
    1.27  {
    1.28  	if [ -b "$1" ]; then
    1.29 @@ -1177,33 +1196,49 @@
    1.30  	# GPT partition + fat32 format for the remaining space
    1.31  	sectors=$(($(sectcnt $device)-1))
    1.32  	quads2bin $sectors | ddq bs=1 seek=458 of=$device	# pmbr
    1.33 -	quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
    1.34  	quads2bin $((sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
    1.35 -	uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device	# partiton fat32
    1.36 +	uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device	# basic data partiton
    1.37  begin-base64 644 -
    1.38 -H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbz+C/fHwyfEro9Z7E93Fi5/8sH
    1.39 -BhzAiSGRoZghkyGZQYEhBcguAWIFhgIgWQRkZ4JxPkMeAyEAAOuEo7uAAAAA
    1.40 +H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbzOAORwIkhkaGYIZMhmUGBIQXI
    1.41 +LgFiBYYCIFkEZGeCcT5DHkFzAAqvwhqAAAAA
    1.42  ====
    1.43  EOT
    1.44 +	ddq if=/dev/urandom bs=16 count=1 seek=73 of=$device		# partition uuid
    1.45  	last=$(sectcnt "$ISO")
    1.46  	custom=$((4*$(get 32848 $device 4)))
    1.47  	[ $custom -gt $((last-4)) ] && last=$((custom+4))		# room for cmdline
    1.48 -	quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device	# vfat first address
    1.49 -	quads2bin $((sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device	# vfat last address
    1.50 -	quads2bin $(isohybrid --crc32 $device 1024 $(($(get 596 $device 4)*$(get 592 $device 4)))) | \
    1.51 -		ddq bs=1 seek=$((512+88)) of=$device			# CRC32 partitions
    1.52 -	ddn of=$device if=$device bs=512 skip=1 seek=$sectors count=1
    1.53 -	ddn of=$device if=$device bs=512 skip=2 seek=$((sectors-1)) count=1
    1.54 -	quads2bin $sectors 0 1 0 | ddq bs=1 seek=$((sectors*512+24)) of=$device	# my gpt, alt gpt
    1.55 -	quads2bin 1 0 $sectors 0 | ddq bs=1 seek=$((512+24)) of=$device	# my gpt, alt gpt
    1.56 -	quads2bin $((sectors-1)) 0 | ddq bs=1 seek=$((sectors*512+72)) of=$device
    1.57 -	i=$(get 524 $device 4)
    1.58 -	quads2bin $(isohybrid --crc32 $device $((sectors*512)) $i) | \
    1.59 -		ddq bs=1 seek=$((sectors*512+16)) of=$device	# CRC32 header
    1.60 -	quads2bin $(isohybrid --crc32 $device 512 $i) | ddq bs=1 seek=$((512+16)) of=$device	# CRC32 header
    1.61 -	partprobe $device
    1.62 -	homedev=/dev/$(basename /sys/block/${device#/dev/}/${device#/dev/}*2)
    1.63 -	mkdosfs -n 'SLITAZ HOME' $homedev
    1.64 +	quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device	# partition first address
    1.65 +	quads2bin $((sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device	# partition last address
    1.66 +	fixup_gpt $device $sectors
    1.67 +	[ -b ${device}p2 ] && pdev=${device}p2 || pdev=${device}2
    1.68 +	value=$(cat /sys/block/${device#/dev/}/${pdev#/dev/}/size)
    1.69 +	[ ${#value} -gt 7 -a "$(which mkfs.exfat)" ] && value="exfat" || value="fat32"
    1.70 +	if [ -z "$1" ]; then
    1.71 +		echo -n "$DIALOG --clear --title \" Select the filesystem \" \
    1.72 +--radiolist \"\\nPlease select the filesystem type to create.\" 14 70 4" > /tmp/dialog$$
    1.73 +		while read type rem; do
    1.74 +			which mkfs.${type/fat32/vfat} > /dev/null || continue
    1.75 +			echo -n " $type \"$rem" >> /tmp/dialog$$
    1.76 +		done <<EOT
    1.77 +fat32	for a small key"	$([ "$value" = "fat32" ] && echo "on" || echo "off")
    1.78 +exfat	for a large key"	$([ "$value" = "exfat" ] && echo "on" || echo "off")
    1.79 +ntfs	"			off
    1.80 +ext3	for most linux"		off
    1.81 +ext4	"			off
    1.82 +btrfs	for recent linux"	off
    1.83 +xfs
    1.84 +EOT
    1.85 +		exec 3>&1
    1.86 +		value=$(. /tmp/dialog$$ 2>&1 1>&3)
    1.87 +		retval=$?
    1.88 +		exec 3>&-
    1.89 +		rm -f /tmp/dialog$$
    1.90 +	fi
    1.91 +	homedev=/dev/$(basename /sys/block/${device#/dev/}/${pdev#/dev/})
    1.92 +	case "$value" in
    1.93 +	*fat*)	mkfs.${value/fat32/vfat} -n 'SLITAZ HOME' $homedev;;
    1.94 +	*)	mkfs.$value -L 'SLITAZ HOME' $homedev;;
    1.95 +	esac > /dev/null 2>&1
    1.96  
    1.97  	# update boot/exe crc16
    1.98  	words2bin 0 | ddq bs=1 seek=18 of=$device
    1.99 @@ -1211,7 +1246,7 @@
   1.100  	i=$(($(od -v -N $i -t u2 -w2 -An $device | \
   1.101  		awk '{ i+= $0 } END { print (i % 65536) }') \
   1.102  		+ $(get $((i+1)) $device 1)))
   1.103 -	words2bin $(( (-i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
   1.104 +	words2bin $(( (-i -1) & 65535 )) | ddq bs=1 seek=18 of=$device
   1.105  
   1.106  	[ "$1" ] || $DIALOG --clear --title " Set /home persistent " \
   1.107  			--yes-label "Continue" --yesno \
   1.108 @@ -1219,12 +1254,63 @@
   1.109  This option will mount /home on the USB key vfat during the boot process.\n\n
   1.110  Your own data will be saved, but the system stay not upgradable.\n" 16 70
   1.111  	if [ $? -eq 0 ]; then
   1.112 -		data="append=home=$(blkid $homedev | sed 's|.* UUID="||;s|".*||') kmap=$(cat /etc/keymap.conf) lang=${LANG%.UTF*} tz=$(cat /etc/TZ) loadfs"
   1.113 -		cat <<EOT | ddn bs=512 seek=$custom of=$device
   1.114 -#!boot $(echo "$data" | md5sum | sed 's/ .*//')
   1.115 -$data
   1.116 +		echo -en "$(echo "SliTaz persistent /home" | sed 's|.|&\\0|g')" | ddn bs=8 seek=151 of=$device
   1.117 +		fixup_gpt $device $sectors
   1.118 +		[ "$(ddn bs=512 skip=$custom if=$device | ddn bs=1 count=6)" = "#!boot" ] && return
   1.119 +		mkdir /tmp/mnt$$
   1.120 +		mount $pdev /tmp/mnt$$
   1.121 +		echo -e "keyboard\nlocale\ntimezone" > /tmp/dialog.out$$
   1.122 +		touch /tmp/dialog$$
   1.123 +		if [ -z "$1" ]; then
   1.124 +			cat > /tmp/dialog$$ <<EOT
   1.125 +$DIALOG --clear --title " Select configuration " \
   1.126 +	--separate-output \
   1.127 +	--cancel-label "Skip" \
   1.128 +	--checklist "Please select the configuration to store." \
   1.129 +	0 0 0 \
   1.130 +keyboard "kmap=$(cat /etc/keymap.conf)" on \
   1.131 +locale "lang=${LANG%.UTF*}" on \
   1.132 +timezone "tz=$(cat /etc/TZ)" on \
   1.133 +$([ -s /tmp/mnt$$/boot/rootfs.gz ] || cat <<EOM
   1.134 +network "/etc/network.conf" off \
   1.135 +ssh "/etc/dropbear" off \
   1.136 +password "/etc/passwd /etc/*shadow /etc/group" off \
   1.137 +custom "Your own list of files" off
   1.138 +EOM
   1.139 +)
   1.140 +EOT
   1.141 +			sh /tmp/dialog$$ 2> /tmp/dialog.out$$
   1.142 +			[ $? -eq 0 ] || echo -n "" > /tmp/dialog.out$$
   1.143 +		fi
   1.144 +		data=""; files=""
   1.145 +		while read i ; do
   1.146 +			case "$i" in
   1.147 +			keyboard)	data="${data}kmap=$(cat /etc/keymap.conf) ";;
   1.148 +			locale)		data="${data}lang=${LANG%.UTF*} " ;;
   1.149 +			timezone)	data="${data}tz=$(cat /etc/TZ) " ;;
   1.150 +			network)	files="${files} /etc/network.conf" ;;
   1.151 +			ssh)		files="${files} /etc/dropbear" ;;
   1.152 +			password)	files="${files} /etc/passwd /etc/*shadow /etc/group" ;;
   1.153 +			custom) 	exec 3>&1
   1.154 +					custom="$($DIALOG --clear --title " Custom files " \
   1.155 +				--inputbox "\nEnter the list of files to save:\n" 10 70 2>&1 1>&3)"
   1.156 +					retval=$?
   1.157 +					exec 3>&-
   1.158 +					[ $retval -eq 0 ] && files="${files} $custom" ;;
   1.159 +			esac
   1.160 +		done < /tmp/dialog.out$$
   1.161 +		rm -f /tmp/dialog$$ /tmp/dialog.out$$
   1.162 +		[ "$data" ] && cat <<EOT | ddn bs=512 seek=$custom of=$device
   1.163 +#!boot $(echo "append=$data" | md5sum | sed 's/ .*//')
   1.164 +append=$data
   1.165  --
   1.166  EOT
   1.167 +		if [ "$files" ]; then
   1.168 +			mkdir /tmp/mnt$$/boot 2> /dev/null
   1.169 +			find $files | cpio -o -H newc | gzip -9 > /tmp/mnt$$/boot/rootfs.gz
   1.170 +		fi
   1.171 +		umount /tmp/mnt$$
   1.172 +		rm -rf /tmp/mnt$$
   1.173  	fi
   1.174  }
   1.175  
   1.176 @@ -1571,7 +1657,7 @@
   1.177  	keymap="$(cat /etc/keymap.conf 2>/dev/null)"
   1.178  	locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
   1.179  	cat > /tmp/dialog$$ <<EOT
   1.180 -$DIALOG  --clear --title " $(isotitle) " --menu "" 28 70 30 \
   1.181 +$DIALOG  --clear --title " $(isotitle) " --menu "" 0 0 0 \
   1.182  $(initxfile tazkeymap	"tazkeymap"	"Select keyboard (${keymap:-none})") \
   1.183  $(initxfile tazlocale	"tazlocale"	"Select locale (${locale:-none})") \
   1.184  $(initx			"live"		"Linux RAM boot (full desktop)") \
   1.185 @@ -1592,7 +1678,7 @@
   1.186  $(gotposixovlzip	"inst2zip"	"ZIP installation archive (UMSDOS way)") \
   1.187  $(gotposixovlzip	"insttaz2zip"	"ZIP installation archive (TAZUSB way)") \
   1.188  $(gottazusb 		"usbkey"	"USB key read/write installation") \
   1.189 -$(ishybrid		"usbbootkey"	"USB boot key (not upgradable)") \
   1.190 +$(ishybrid		"usbbootkey"	"USB boot key (kernel not upgradable)") \
   1.191  $(hasflavinfo		"showfavinfo"	"Show flavor extra info") \
   1.192  $(hasflavor		"flavor"	"Get flavor file") \
   1.193  $(cdfile isolinux.cfg	"floppyset"	"Boot floppy set") \