wok-6.x rev 24177

syslinux: add apple partitions
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 30 19:33:58 2021 +0000 (2021-12-30)
parents 62cc22bebaa9
children b093349fa789
files syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/taziso
line diff
     1.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Thu Dec 30 18:02:41 2021 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Thu Dec 30 19:33:58 2021 +0000
     1.3 @@ -600,4 +600,25 @@
     1.4  	.ascii	"This program cannot be run in DOS mode.$"
     1.5  	.org	0x0778,0xEE
     1.6  
     1.7 +	.macro	apple_partition	count=2, start=1, size=2, name, namesz, type, typesz, start_data, size_data, status
     1.8 +	.byte	0x50, 0x4D, 0, 0	/* PM */
     1.9 +#define BE(x) (((x)>>24)|((((x)>>16)&255)<<8)|((((x)>>8)&255)<<16)|(((x)&255)<<24))
    1.10 +	.long	BE(\count)
    1.11 +	.long	BE(\start)
    1.12 +	.long	BE(\size)
    1.13 +	.ascii	"\name"
    1.14 +	.ds.b	32-\namesz, 0
    1.15 +	.ascii	"\type"
    1.16 +	.ds.b	32-\typesz, 0
    1.17 +	.long	BE(\start_data)
    1.18 +	.long	BE(\size_data)
    1.19 +	.long	BE(\status)
    1.20 +	.ds.b	44,0			/* boot code & processor info */
    1.21 +	.endm
    1.22 +
    1.23 +	.org	0x800,0
    1.24 +	apple_partition 2, 1, 2, "Apple", 5, "Apple_partition_map", 19, 0, 2, 3 /* valid, allocated */
    1.25 +	.org	0x1000,0
    1.26 +	apple_partition 2, 1, 2, "EFI", 3, "Apple_HFS", 9, 0, 0, 0x40000013 /* valid, allocated, readable, automatically mount at startup */
    1.27 +
    1.28  	.end
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Thu Dec 30 18:02:41 2021 +0000
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Dec 30 19:33:58 2021 +0000
     2.3 @@ -15,8 +15,8 @@
     2.4  	local i
     2.5  	local n
     2.6  	n=$2; for i in $(seq 8 8 ${4:-16}); do
     2.7 -		printf '\\\\x%02X' $(($n & 255))
     2.8 -		n=$(($n >> 8))
     2.9 +		printf '\\\\x%02X' $((n & 255))
    2.10 +		n=$((n >> 8))
    2.11  	done | xargs echo -en | ddn bs=1 of=$3 seek=$(($1))
    2.12  }
    2.13  
    2.14 @@ -47,7 +47,7 @@
    2.15  		$0 --get rootfs.gz > $TMP/rootfs.gz
    2.16  		SIZE=$(wc -c < $TMP/rootfs.gz)
    2.17  		store 24 $SIZE $1
    2.18 -		OFS=$(( 0x7FF0 - $SIZE ))
    2.19 +		OFS=$(( 0x7FF0 - SIZE ))
    2.20  		printf "Adding rootfs.gz file at %04X (%d bytes) ...\n" $OFS $SIZE
    2.21  		ddn if=$TMP/rootfs.gz of=$1 bs=1 seek=$OFS
    2.22  	fi
    2.23 @@ -63,7 +63,7 @@
    2.24  	n=$(stat -c %s /tmp/rezipped$$.gz)
    2.25  	printf "Moving tazlito data record at %04X ($n bytes) ...\n" $OFS
    2.26  	ddn if=/tmp/rezipped$$.gz bs=1 of=$1 seek=$OFS
    2.27 -	HOLE=$(($HOLE+$n))
    2.28 +	HOLE=$((HOLE+n))
    2.29  	rm -f /tmp/rezipped$$.gz
    2.30  	if [ -n "$gpt" ]; then
    2.31  		store $((0x25E)) $n $1
    2.32 @@ -73,51 +73,61 @@
    2.33  
    2.34  add_win32exe()
    2.35  {
    2.36 +	$0 --get bootiso.bin 2> /dev/null > /tmp/bin$$
    2.37  	SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c)
    2.38  	n=1536
    2.39 -	SIZE=$(($SIZE+$n))
    2.40 +	cut=$((0x98+$(get 0x94 /tmp/exe$$)))	### end of header
    2.41 +	if [ $(get 2048 /tmp/bin$$) -eq 19792 ]; then		### Fix EFI Apple partition
    2.42 +		o=$(($(get 584 "$1")*512))
    2.43 +		f=$(($(get $((o+0x20)) "$1" 4)/4))
    2.44 +		l=$((($(get $((o+0x28)) "$1" 4)+1)/4-f))
    2.45 +		store $((0x1008)) $(printf "%08x" $f | sed 's|\(..\)\(..\)\(..\)\(..\)|0x\4\3\2\1|') /tmp/bin$$ 32
    2.46 +		store $((0x1054)) $(printf "%08x" $l | sed 's|\(..\)\(..\)\(..\)\(..\)|0x\4\3\2\1|') /tmp/bin$$ 32
    2.47 +		n=4608
    2.48 +	fi
    2.49 +	SIZE=$((SIZE+n))
    2.50  	printf "Adding WIN32 file at %04X (%d bytes) ...\n" 0 $SIZE
    2.51  	[ -n "$gpt" ] && printf "Adding GPT at %04X (1024 bytes) ...\n" 512
    2.52 -	for i in $(seq 396 40 $((356+$(get 0x86 /tmp/exe$$)*40))); do
    2.53 -		x=$(($n + $(get $i /tmp/exe$$)))
    2.54 -		store $(($i)) $x /tmp/exe$$	### section offset
    2.55 +	for i in $(seq 396 40 $((356+$(get 0x86 /tmp/exe$$)*40))); do	### 18C 1B4 1DC
    2.56 +		x=$((n + $(get $i /tmp/exe$$)))
    2.57 +		store $i $x /tmp/exe$$		### section offset
    2.58  	done
    2.59 -	cut=$((0x98+$(get 0x94 /tmp/exe$$)))	### end of header
    2.60 -	store $((0x94)) $(($n + $cut - 0x98)) /tmp/exe$$
    2.61 +	store $((0x94)) $((n + cut - 0x98)) /tmp/exe$$
    2.62  	ddn if=/tmp/exe$$ of=$1 bs=1 count=$cut
    2.63 -	ddn if=/tmp/exe$$ of=$1 bs=1 skip=$cut seek=$(($n+$cut))
    2.64 +	ddn if=/tmp/exe$$ of=$1 bs=1 skip=$cut seek=$((n+cut))
    2.65  	printf "Adding bootiso head at %04X...\n" 0
    2.66 -	$0 --get bootiso.bin 2> /dev/null > /tmp/exe$$
    2.67  	store 510 $((0xAA55)) $1
    2.68  	while read adrs sz; do
    2.69 -		ddn if=/tmp/exe$$ of=$1 bs=1 count=$((0x$sz)) seek=$((0x$adrs)) skip=$((0x$adrs))
    2.70 +		ddn if=/tmp/bin$$ of=$1 bs=1 count=$((0x$sz)) seek=$((0x$adrs)) skip=$((0x$adrs))
    2.71  	done <<EOT
    2.72 -0000 0080
    2.73 -0178 0040
    2.74 -0270 0190
    2.75 -0600 0178
    2.76 +0000 0080	### DOS stub + MBR
    2.77 +0178 0040	### partition boot code + MBR partitions (178..26F)
    2.78 +0270 0190	### DOS EXE code (400-5FF=head buf)
    2.79 +0600 0178	### iso hybrid boot code
    2.80 +0800 0088	### Apple partition 1
    2.81 +1000 0088	### Apple partition 1
    2.82  EOT
    2.83  	i=$((0x600))
    2.84  	OFS=$SIZE
    2.85 -	rm -f /tmp/exe$$ /tmp/coff$$
    2.86 +	rm -f /tmp/exe$$ /tmp/bin$$
    2.87  	if [ -z "$RECURSIVE_PARTITION" -a $(get 454 $1 4) -eq 0 ]; then
    2.88 -		store 448 $((1+$i/512)) $1 8			### 446+2 SECTOR
    2.89 -		store 454 $(($i/512)) $1 32			### 446+8 OFFSET
    2.90 +		store 448 $((1+i/512)) $1 8			### 446+2 SECTOR
    2.91 +		store 454 $((i/512)) $1 32			### 446+8 OFFSET
    2.92  		store 458 $(($(stat -c %s $1)/512)) $1 32	### 446+12 SIZE
    2.93  	fi
    2.94  	mkdir /tmp/mnt$$	
    2.95  	mount -o loop,ro $1 /tmp/mnt$$
    2.96  	if [ -s /tmp/mnt$$/boot/linld.com ]; then
    2.97  		i=$(($(get 20 $1)-0xC0))
    2.98 -		store $(($i-6)) $(($(busybox stat -m /tmp/mnt$$/boot/linld.com | sed q)*2048)) $1 32
    2.99 -		store $(($i-2)) $(stat -c %s /tmp/mnt$$/boot/linld.com) $1
   2.100 +		store $((i-6)) $(($(busybox stat -m /tmp/mnt$$/boot/linld.com | sed q)*2048)) $1 32
   2.101 +		store $((i-2)) $(stat -c %s /tmp/mnt$$/boot/linld.com) $1
   2.102  		r="$(sed '/rootfs[0-9]/!d;s|.* initrd=||;s|/boot/||g;s| .*||' \
   2.103  			/tmp/mnt$$/boot/isolinux/isolinux.cfg | tail -n1)"
   2.104  		if grep -qs rootfs /tmp/mnt$$/boot/isolinux/isolinux.cfg ; then
   2.105  			echo -n "image=/boot/bzImage initrd=${r:-rootfs.gz},! autologin rdinit=/init.exe"
   2.106  		else
   2.107  			echo -n "$(sed '/KERNEL/!d;s|.*KERNEL *|image=|;q' /tmp/mnt$$/boot/isolinux/isolinux.cfg)"
   2.108 -		fi | ddn bs=1 of=$1 conv=notrunc seek=$(($i-134))
   2.109 +		fi | ddn bs=1 of=$1 conv=notrunc seek=$((i-134))
   2.110  	fi
   2.111  	umount /tmp/mnt$$	
   2.112  	rmdir /tmp/mnt$$	
   2.113 @@ -127,14 +137,14 @@
   2.114  {
   2.115  	SIZE=$($0 --get bootfd.bin 2> /dev/null | wc -c)
   2.116  	if [ $SIZE -ne 0 ]; then
   2.117 -		SIZE=$(( $SIZE -  512 )) # sector 2 is data
   2.118 -		OFS=$(( $OFS - $SIZE ))
   2.119 +		SIZE=$(( SIZE -  512 ))				### sector 2 is data
   2.120 +		OFS=$(( OFS - SIZE ))
   2.121  		printf "Adding floppy bootstrap file at %04X (%d bytes) ...\n" $OFS $SIZE
   2.122  		$0 --get bootfd.bin | \
   2.123  		ddn of=$1 bs=1 count=512 seek=$OFS
   2.124  		$0 --get bootfd.bin | \
   2.125 -		ddn of=$1 bs=1 skip=1024 seek=$((512 + $OFS))
   2.126 -		store 26 $(($SIZE/512)) $1 8
   2.127 +		ddn of=$1 bs=1 skip=1024 seek=$((512 + OFS))
   2.128 +		store 26 $((SIZE/512)) $1 8
   2.129  	fi
   2.130  }
   2.131  
   2.132 @@ -163,33 +173,33 @@
   2.133  	case "$1" in
   2.134  	win32.exe)	[ $x -eq 2048 ] && x=10752
   2.135  			[ $x -eq 1024 ] || SIZE=$x;;
   2.136 -	syslinux.mbr)	[ $x -eq 1024 ] || OFFSET=$(($x - 512)); SIZE=336;;
   2.137 +	syslinux.mbr)	[ $x -eq 1024 ] || OFFSET=$((x - 512)); SIZE=336;;
   2.138  	flavor.info)	[ $(get 22528 "$ISO") -eq 35615 ] && OFFSET=22528
   2.139  			[ $x -eq 2048 ] && x=$(get 0x25C "$ISO") &&
   2.140  					   SIZE=$(get 0x25E "$ISO")
   2.141  			[ $(get $x "$ISO") -eq 35615 ] && OFFSET=$x
   2.142  			[ $OFFSET -ne 0 ] && [ $SIZE -eq 0 ] &&
   2.143 -			SIZE=$(ddq bs=512 skip=$(($OFFSET/512)) if="$ISO" | gzsize);;
   2.144 +			SIZE=$(ddq bs=512 skip=$((OFFSET/512)) if="$ISO" | gzsize);;
   2.145  	floppy.boot)	SIZE=$(($(get 26 "$ISO" 1)*512))
   2.146 -			OFFSET=$(($(get 64 "$ISO") - 0xC0 - $SIZE));;
   2.147 -	rootfs.gz)	SIZE=$(get 24 "$ISO"); OFFSET=$(($stub - $SIZE));;
   2.148 +			OFFSET=$(($(get 64 "$ISO") - 0xC0 - SIZE));;
   2.149 +	rootfs.gz)	SIZE=$(get 24 "$ISO"); OFFSET=$((stub - SIZE));;
   2.150  	isoboot.com)	OFFSET=$(($(get 64 "$ISO") - 0xC0))
   2.151 -			SIZE=$(($stub - $(get 24 "$ISO") - $OFFSET));;
   2.152 -	dosstub)	[ "$dosstub" ] && OFFSET=$stub && SIZE=$((0x7FF0 - $OFFSET));;
   2.153 +			SIZE=$((stub - $(get 24 "$ISO") - OFFSET));;
   2.154 +	dosstub)	[ "$dosstub" ] && OFFSET=$stub && SIZE=$((0x7FF0 - OFFSET));;
   2.155  	boot.md5)	[ $(get 0 "$ISO") -eq 23117 ] &&
   2.156  			[ $(get 18 "$ISO") -ne 0 ] &&
   2.157  			OFFSET=$((0x7FF0)) && SIZE=16;;
   2.158  	fs.iso)		OFFSET=$((0x8000))
   2.159 -			SIZE=$((2048*$c - $OFFSET));;
   2.160 +			SIZE=$((2048*c - OFFSET));;
   2.161  	custom.magic)	ddq bs=2k skip=$c if="$ISO" | ddq bs=1 count=6 | \
   2.162 -				grep -q '#!boot' && OFFSET=$((2048*$c)) &&
   2.163 +				grep -q '#!boot' && OFFSET=$((2048*c)) &&
   2.164  			SIZE=39 ;;
   2.165 -	custom.append)  OFFSET=$((2048*$c+47)) &&
   2.166 +	custom.append)  OFFSET=$((2048*c+47)) &&
   2.167  			SIZE=$(ddq bs=2k skip=$c if="$ISO" count=1 | \
   2.168  				sed '/^append=/!d;s/^[^=]*=.//' | wc -c);;
   2.169  	custom.initrd)  x=$(ddq bs=2k skip=$c if="$ISO" count=1 | \
   2.170  				sed '/^append=\|^initrd:/!d' | wc -c)
   2.171 -			OFFSET=$((2048*$c+$x+40))
   2.172 +			OFFSET=$((2048*c+x+40))
   2.173  			SIZE=$(($(ddq bs=2k skip=$c if="$ISO" count=1 | \
   2.174  				sed '/^initrd:/!d;s/.*://') + 0));;
   2.175  	esac
   2.176 @@ -199,7 +209,7 @@
   2.177  {
   2.178  	OFFSET=$(stat -c %s "$1")
   2.179  	[ $OFFSET -gt $HEAP ] &&
   2.180 -	printf "%d free bytes in %04X..%04X\n" $(($OFFSET - $HEAP)) $HEAP $OFFSET
   2.181 +	printf "%d free bytes in %04X..%04X\n" $((OFFSET - HEAP)) $HEAP $OFFSET
   2.182  	if [ $(get 510 "$1") -eq 43605 ]; then
   2.183  		echo "MBR partitions :"
   2.184  		for i in 0 1 2 3; do
   2.185 @@ -216,14 +226,14 @@
   2.186  			o=$(($(get 584 "$1")*512))
   2.187  			i=0
   2.188  			while [ $i -lt $n ]; do
   2.189 -				f=$(get $(($o+0x20)) "$1" 4)
   2.190 -				l=$(($(get $(($o+0x28)) "$1" 4)-$f))
   2.191 +				f=$(get $((o+0x20)) "$1" 4)
   2.192 +				l=$(($(get $((o+0x28)) "$1" 4)-f))
   2.193  				[ $l -eq 0 ] && break
   2.194 -				printf " $i:%08X  %08X  %s\n" $f $(($l+1)) \
   2.195 -				"$(od -An -N 72 -w72 -j $(($o+0x38)) -t a "$1" \
   2.196 +				printf " $i:%08X  %08X  %s\n" $f $((l+1)) \
   2.197 +				"$(od -An -N 72 -w72 -j $((o+0x38)) -t a "$1" \
   2.198  				 | sed 's/ nul//g;s/   //g;s/ sp//g')"
   2.199 -				o=$(($o+$s))
   2.200 -				i=$(($i+1))
   2.201 +				o=$((o+s))
   2.202 +				i=$((i+1))
   2.203  			done
   2.204  		fi
   2.205  	fi
   2.206 @@ -232,12 +242,12 @@
   2.207  		echo "Apple partitions :"
   2.208  		i=0
   2.209  		while [ $(get $o "$1") -eq 19792 ]; do
   2.210 -			f=$((0x$(od -An -N 4 -j $(($o+8)) -t x1 "$1" | sed 's/ //g')))
   2.211 -			l=$((0x$(od -An -N 4 -j $(($o+0x54)) -t x1 "$1" | sed 's/ //g')))
   2.212 +			f=$((0x$(od -An -N 4 -j $((o+8)) -t x1 "$1" | sed 's/ //g')))
   2.213 +			l=$((0x$(od -An -N 4 -j $((o+0x54)) -t x1 "$1" | sed 's/ //g')))
   2.214  			printf " $i:%08X  %08X  %s\n" $f $l \
   2.215 -			"$(ddq bs=1 skip=$(($o+16)) count=32 if="$1" | strings -n 1)"
   2.216 -			o=$(($o+2048))
   2.217 -			i=$(($i+1))
   2.218 +			"$(ddq bs=1 skip=$((o+16)) count=32 if="$1" | strings -n 1)"
   2.219 +			o=$((o+2048))
   2.220 +			i=$((i+1))
   2.221  		done
   2.222  	fi
   2.223  }
   2.224 @@ -253,9 +263,9 @@
   2.225  		[ "${OFFSET:8}" ] && continue
   2.226  		[ $OFFSET -lt 0 ] && continue
   2.227  		[ $(get $OFFSET "$ISO") -eq 0 ] && continue
   2.228 -		[ $OFFSET -gt $HEAP ] && [ $(($OFFSET - $HEAP)) -gt 16 ] &&
   2.229 -		printf "%d free bytes in %04X..%04X\n" $(($OFFSET - $HEAP)) $HEAP $OFFSET
   2.230 -		[ $OFFSET -ge $HEAP ] && HEAP=$(($OFFSET+$SIZE))
   2.231 +		[ $OFFSET -gt $HEAP ] && [ $((OFFSET - HEAP)) -gt 16 ] &&
   2.232 +		printf "%d free bytes in %04X..%04X\n" $((OFFSET - HEAP)) $HEAP $OFFSET
   2.233 +		[ $OFFSET -ge $HEAP ] && HEAP=$((OFFSET+SIZE))
   2.234  		printf "$f at %04X ($SIZE bytes).\n" $OFFSET
   2.235  	done
   2.236  	trailer $ISO
   2.237 @@ -273,7 +283,7 @@
   2.238  			[ $n -eq 0 -o $n -gt 64 ] && continue
   2.239  			store $((0x1C0+16*i)) 1 $1 8
   2.240  			store $((0x1C6+16*i)) 0 $1 32
   2.241 -			store $((0x1CA+16*i)) $(($(get $((0x1CA+16*i)) $1 4)+$n)) $1 32
   2.242 +			store $((0x1CA+16*i)) $(($(get $((0x1CA+16*i)) $1 4)+n)) $1 32
   2.243  		done
   2.244  	fi
   2.245  }
   2.246 @@ -296,7 +306,7 @@
   2.247  clear_custom_config()
   2.248  {
   2.249  	start=$(custom_config_sector $1)
   2.250 -	cnt=$((512 - ($start % 512)))
   2.251 +	cnt=$((512 - (start % 512)))
   2.252  	[ $cnt -ne 512 ] &&
   2.253  	ddq if=/dev/zero of=$1 bs=2k seek=$start count=$cnt
   2.254  }
   2.255 @@ -328,7 +338,7 @@
   2.256  $(tar cf - ${@/init/rootfs.gz} | compress | uuencode -m -)
   2.257  EOT
   2.258  EOM
   2.259 -	sed -i 's|[ \t]*###.*||;/^case/,/^esac/d' $0.$$
   2.260 +	sed -i '/^##/d;s|[ \t]*###.*||;/^case/,/^esac/d' $0.$$
   2.261  	mv -f $0.$$ $0; exit ;;
   2.262  --get)
   2.263  	cat $2
   2.264 @@ -341,7 +351,7 @@
   2.265  	add_rootfs $DATA --array > /dev/null
   2.266  	add_fdbootstrap $DATA > /dev/null
   2.267  	name=${3:-bootiso}
   2.268 -	BOOTISOSZ=$((0x8000 - $OFS + $HSZ))
   2.269 +	BOOTISOSZ=$((0x8000 - OFS + HSZ))
   2.270  	cat <<EOT
   2.271  
   2.272  #define $(echo $name | tr '[a-z]' '[A-Z]')SZ $BOOTISOSZ
   2.273 @@ -406,14 +416,14 @@
   2.274  };
   2.275  #endif
   2.276  
   2.277 -#define C_array (uint32_t *) ($name + $(($BOOTISOSZ)))
   2.278 -#define P_array (char *)     ($name + $(($BOOTISOSZ+(64*4))))
   2.279 -#define S_array (char *)     ($name + $(($BOOTISOSZ+(64*4)+64)))
   2.280 +#define C_array (uint32_t *) ($name + $((BOOTISOSZ)))
   2.281 +#define P_array (char *)     ($name + $((BOOTISOSZ+(64*4))))
   2.282 +#define S_array (char *)     ($name + $((BOOTISOSZ+(64*4)+64)))
   2.283  #define ELTORITOOFS	3
   2.284  EOT
   2.285  			fi
   2.286 -			echo "#define $tag	$(($BOOTISOSZ+(64*4)+64+16+$ofs))"
   2.287 -			ofs=$(($(echo -en "$str\0" | wc -c)+$ofs))
   2.288 +			echo "#define $tag	$((BOOTISOSZ+(64*4)+64+16+ofs))"
   2.289 +			ofs=$(($(echo -en "$str\0" | wc -c)+ofs))
   2.290  		fi
   2.291  	done <<EOT
   2.292  READSECTORERR	Read sector failure.
   2.293 @@ -449,7 +459,7 @@
   2.294  done
   2.295  	cat <<EOT
   2.296  #ifdef __MSDOS__
   2.297 -#define BOOTISOFULLSIZE	$(($BOOTISOSZ+(64*4)+64+16+$ofs))
   2.298 +#define BOOTISOFULLSIZE	$((BOOTISOSZ+(64*4)+64+16+ofs))
   2.299  static char bootiso[BOOTISOFULLSIZE];
   2.300  static data_fixup(void)
   2.301  {
   2.302 @@ -491,8 +501,8 @@
   2.303  	# --exe mvcom.bin x.com y.exe > xy.exe
   2.304  	cat $4 $3 > /tmp/exe$$
   2.305  	S=$(stat -c %s /tmp/exe$$)
   2.306 -	store 2 $(($S%512)) /tmp/exe$$
   2.307 -	store 4 $((($S+511)/512)) /tmp/exe$$
   2.308 +	store 2 $((S%512)) /tmp/exe$$
   2.309 +	store 4 $(((S+511)/512)) /tmp/exe$$
   2.310  	store 14 -16 /tmp/exe$$
   2.311  	store 16 -2 /tmp/exe$$
   2.312  	store 20 256 /tmp/exe$$
   2.313 @@ -535,7 +545,7 @@
   2.314  	    case "$(get 0 $1)" in
   2.315  	    23117)
   2.316  		b=$(get 417 $1 1)
   2.317 -		n=$(($(get 64 $1) + 0xC0 - ($(get 26 $1 1)*512) - ($b+1)*512))
   2.318 +		n=$(($(get 64 $1) + 0xC0 - ($(get 26 $1 1)*512) - (b+1)*512))
   2.319  		ddq if=$1 bs=512 count=1 skip=$b of=/tmp/hymbr$$
   2.320  		restore_hybrid_mbr /tmp/hymbr$$ $1
   2.321  		ddn if=/tmp/hymbr$$ of=$1
   2.322 @@ -547,8 +557,8 @@
   2.323  			ddn if=/dev/zero bs=512 seek=3 count=1 of=$1
   2.324  		else
   2.325  			ddn if=/dev/zero bs=512 seek=1 count=1 of=$1
   2.326 -			ddn if=$1 bs=512 seek=2 count=30 skip=$(($b+1)) of=$1
   2.327 -			ddn if=/dev/zero bs=1 seek=$n count=$((0x8000 - $n)) of=$1
   2.328 +			ddn if=$1 bs=512 seek=2 count=30 skip=$((b+1)) of=$1
   2.329 +			ddn if=/dev/zero bs=1 seek=$n count=$((0x8000 - n)) of=$1
   2.330  		fi ;;
   2.331  	    *)  ddn if=/dev/zero bs=1k count=32 of=$1 ;;
   2.332  	    esac
   2.333 @@ -563,29 +573,21 @@
   2.334  	esac
   2.335  	case "$(get 0 $1)" in
   2.336  	23117)	echo "The file $1 is already an EXE file." 1>&2 && exit 1;;
   2.337 -	0)	[ -x /usr/bin/isohybrid ] && isohybrid -entry 2 $1;;
   2.338 +	0)	[ -x /usr/bin/isohybrid ] && isohybrid -entry 2 $1;;	### Add gpt EFI
   2.339  	esac
   2.340  
   2.341  	gpt= ; [ $(get 450 $1) -eq 65262 ] && gpt=1
   2.342 -	mac= ; [ $(get 2048 $1) -eq 19792 ] && mac=1
   2.343 -	echo "Read hybrid & tazlito data..."
   2.344 -	if [ -n "$gpt" ]; then
   2.345 -		echo "GUID Partition Table..."
   2.346 -		n=3; [ -n "$mac" ] && n=9 && echo "Apple Partition Table..."
   2.347 -		ddq if=$1 bs=512 count=$n of=/tmp/hybrid$$
   2.348 -		ddq if=$1 bs=512 skip=44 count=20 of=/tmp/tazlito$$
   2.349 -	else
   2.350 -		ddq if=$1 bs=512 count=1 of=/tmp/hybrid$$
   2.351 -		ddq if=$1 bs=512 skip=2 count=20 of=/tmp/tazlito$$
   2.352 -	fi
   2.353 -	add_win32exe $1 /tmp/hybrid$$
   2.354 +	echo "Read tazlito data..."
   2.355 +	n=2; [ -n "$gpt" ] && n=44 && echo "GUID Partition Table..."
   2.356 +	ddq if=$1 bs=512 skip=$n count=20 of=/tmp/tazlito$$
   2.357 +	add_win32exe $1
   2.358  	add_tazlito_info $1 /tmp/tazlito$$
   2.359 -	rm -f /tmp/tazlito$$ /tmp/hybrid$$
   2.360 +	rm -f /tmp/tazlito$$
   2.361  	
   2.362  	# keep the largest room for the tazlito info file
   2.363  	add_rootfs $1
   2.364  	add_fdbootstrap $1
   2.365 -	printf "%d free bytes in %04X..%04X\n" $(($OFS-$HOLE)) $HOLE $OFS
   2.366 +	printf "%d free bytes in %04X..%04X\n" $((OFS-HOLE)) $HOLE $OFS
   2.367  	store 440 $(date +%s) $1 32
   2.368  	[ "$2" ] && echo "$2               " | \
   2.369  		ddn bs=1 seek=$((0x7FDE)) count=15 of=$1
   2.370 @@ -607,20 +609,20 @@
   2.371  		echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \
   2.372  		ddq bs=2k seek=$(custom_config_sector $1) of=$1
   2.373  		newsz=$(stat -c %s $1)
   2.374 -		mb=$(((($newsz -1)/1048576)+1))
   2.375 -		HEAP=$(($mb*1048576))
   2.376 +		mb=$((((newsz -1)/1048576)+1))
   2.377 +		HEAP=$((mb*1048576))
   2.378  		ddq bs=1048576 seek=$mb count=0 of=$1
   2.379  		h=$(get 417 "$1" 1)
   2.380  		[ -z "$RECURSIVE_PARTITION" ] || h=0
   2.381  		for i in 0 1 2 3 ; do
   2.382  			[ $(get $((0x1BE+16*i)) $1 2) = $((0x0080)) ] || continue
   2.383 -			store $((0x1CA+16*i)) $(($mb*2048-$h)) $1 32
   2.384 -			store $((0x1C5+16*i)) $(($mb-1)) $1 8
   2.385 +			store $((0x1CA+16*i)) $((mb*2048-h)) $1 32
   2.386 +			store $((0x1C5+16*i)) $((mb-1)) $1 8
   2.387  		done
   2.388  		if [ $newsz -gt $isosz ]; then
   2.389 -			echo "$(($newsz - $isosz)) extra bytes."
   2.390 +			echo "$((newsz - isosz)) extra bytes."
   2.391  		else
   2.392 -			echo "$(($isosz - 2048*$(get 32848 $1 4)
   2.393 +			echo "$((isosz - 2048*$(get 32848 $1 4)
   2.394  				 - $(stat -c %s $DATA) - 24)) bytes free."
   2.395  		fi
   2.396  		rm -f $DATA > /dev/null
   2.397 @@ -630,8 +632,8 @@
   2.398  		n=$(($(get 2 $1) - 1 + ($(get 4 $1) - 1)*512))
   2.399  		n=$(($(od -v -N $n -t u2 -w2 -An $1 | \
   2.400  		       awk '{ i+= $0 } END { print (i % 65536) }') \
   2.401 -		     + $(get $(($n+1)) $1 1)))
   2.402 -		store 18 $(( (-$n -1) % 65536 )) $1
   2.403 +		     + $(get $((n+1)) $1 1)))
   2.404 +		store 18 $(( (-n -1) % 65536 )) $1
   2.405  	fi
   2.406  	echo " done."
   2.407  	trailer $1
     3.1 --- a/syslinux/stuff/iso2exe/taziso	Thu Dec 30 18:02:41 2021 +0000
     3.2 +++ b/syslinux/stuff/iso2exe/taziso	Thu Dec 30 19:33:58 2021 +0000
     3.3 @@ -22,22 +22,22 @@
     3.4  bytes2bin()
     3.5  {
     3.6  	for i in $@ ; do
     3.7 -		printf '\\\\x%02X' $(($i&255))
     3.8 +		printf '\\\\x%02X' $((i&255))
     3.9  	done | xargs echo -en
    3.10  }
    3.11  
    3.12  words2bin()
    3.13  {
    3.14  	for i in $@ ; do
    3.15 -		printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
    3.16 +		printf '\\\\x%02X\\\\x%02X' $((i&255)) $(((i>>8)&255))
    3.17  	done | xargs echo -en
    3.18  }
    3.19  
    3.20  quads2bin()
    3.21  {
    3.22  	for i in $@ ; do
    3.23 -		printf '\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X' $(($i&255)) \
    3.24 -			$((($i>>8)&255)) $((($i>>16)&255)) $((($i>>24)&255))
    3.25 +		printf '\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X' $((i&255)) \
    3.26 +			$(((i>>8)&255)) $(((i>>16)&255)) $(((i>>24)&255))
    3.27  	done | xargs echo -en
    3.28  }
    3.29  
    3.30 @@ -46,9 +46,9 @@
    3.31  	echo -e "\nCreating $(basename $1) ..."
    3.32  	gotcdfile linld.com
    3.33  	S=$(($(stat -c %s $file)+12))
    3.34 -	P=$((($S+511)/512))
    3.35 -	E=$((4096-(32*$P)))
    3.36 -	words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 -16 \
    3.37 +	P=$(((S+511)/512))
    3.38 +	E=$((4096-(32*P)))
    3.39 +	words2bin 0x5A4D $((S%512)) $P 0 2 $E -1 -16 \
    3.40  			-2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
    3.41  	dd if=$file bs=1 count=$(($(stat -c %s $file)-1)) >> $1 2> /dev/null
    3.42  	echo -en '@tazboot.cmd\0' >> $1
    3.43 @@ -108,7 +108,7 @@
    3.44  tazusbinitfs()
    3.45  {
    3.46  	PAD=$(($(size $1) % 4))
    3.47 -	[ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
    3.48 +	[ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - PAD)) >> $1
    3.49  	mkdir -p /tmp/fs$$/etc /tmp/fs$$/lib /tmp/fs$$/home
    3.50  	cp -a /etc/locale.conf /etc/locale.conf /tmp/fs$$/etc 2> /dev/null
    3.51  	cat > /tmp/fs$$/init1 <<EOT
    3.52 @@ -771,18 +771,18 @@
    3.53  	R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
    3.54  	[ $R -lt 2500 ] || return
    3.55  	[ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
    3.56 -	ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
    3.57 +	ddq if=$file bs=32 count=1 seek=$((R*16 - 1)) of=/dev/fd0
    3.58  	G="18 0 2 0 0 0 0 0"
    3.59  	[ $J -gt 25 ] || G=""
    3.60  	F=0
    3.61  	for i in 1 2 3; do
    3.62 -		F=$((((2880-$R-$F-$F)*3+1023)/1024))
    3.63 +		F=$((((2880-R-F-F)*3+1023)/1024))
    3.64  	done
    3.65  	bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
    3.66 -		0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
    3.67 +		0 2 2 $((R%256)) $((R/256)) 2 64 0 64 11 0xF0 $F 0 \
    3.68  		$G | ddq bs=1 of=/dev/fd0
    3.69 -	ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
    3.70 -	for i in $R $(($R+$F)) ; do
    3.71 +	ddq if=/dev/zero bs=512 count=$((4+F+F)) seek=$R of=/dev/fd0
    3.72 +	for i in $R $((R+F)) ; do
    3.73  		bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
    3.74  	done
    3.75  	echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
    3.76 @@ -963,9 +963,9 @@
    3.77  	[ $(get 510 "$ISO") -eq 43605 ] || return
    3.78  	C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4)))
    3.79  	[ $(get $C "$ISO" 4) -eq 1 ] || return
    3.80 -	[ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return
    3.81 -	C=$((2048*$(get $(($C+40)) "$ISO" 4)))
    3.82 -	[ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@"
    3.83 +	[ $(get $((C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return
    3.84 +	C=$((2048*$(get $((C+40)) "$ISO" 4)))
    3.85 +	[ $(get $((C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@"
    3.86  }
    3.87  
    3.88  isiso()
    3.89 @@ -999,7 +999,7 @@
    3.90  customsector()
    3.91  {
    3.92  	local c=$(echo $(get 32848 "$ISO" 4))
    3.93 -	hascustomconf $(($c+16)) && echo $(($c+16)) || echo $c
    3.94 +	hascustomconf $((c+16)) && echo $((c+16)) || echo $c
    3.95  }
    3.96  
    3.97  xhascustomconf=hascustomconf
    3.98 @@ -1039,8 +1039,8 @@
    3.99  		\#!boot*) ;;
   3.100  		append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
   3.101  		initrd:*) cnt=${line#initrd:}
   3.102 -			  { ddq bs=512 count=$(($cnt / 512));
   3.103 -			    ddq bs=1 count=$(($cnt % 512)); } > initrd &&
   3.104 +			  { ddq bs=512 count=$((cnt / 512));
   3.105 +			    ddq bs=1 count=$((cnt % 512)); } > initrd &&
   3.106  			  ls -l $PWD/initrd
   3.107  			  break ;;
   3.108  		*)	  break ;;
   3.109 @@ -1086,7 +1086,7 @@
   3.110  	n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512))
   3.111  	if [ $n -lt 40000 -a $n -gt 32768 ]; then
   3.112  		s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }')
   3.113 -		[ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
   3.114 +		[ $(((1+s+$(get $((n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
   3.115  		echo "OK" || echo "ERROR"
   3.116  	fi
   3.117  	if hascustomconf; then
   3.118 @@ -1215,11 +1215,11 @@
   3.119  	dd if=$device bs=1 skip=$(($1)) count=$(($2)) 2> /dev/null | \
   3.120  	od -v -w1 -t u1 -An | {
   3.121  		while read n; do
   3.122 -			local x=$((($crc ^ $n) & 255))
   3.123 +			local x=$(((crc ^ n) & 255))
   3.124  			eval x=0x\$t$x
   3.125 -			crc=$(((($crc >> 8) & 0x00FFFFFF) ^ $x))
   3.126 +			crc=$((((crc >> 8) & 0x00FFFFFF) ^ x))
   3.127  		done
   3.128 -		echo $(($crc ^ 0xFFFFFFFF))
   3.129 +		echo $((crc ^ 0xFFFFFFFF))
   3.130  	}
   3.131  }
   3.132  
   3.133 @@ -1245,8 +1245,8 @@
   3.134  	max=$(($(sectcnt "$ISO")/2048))
   3.135  	i=0; while [ $i -le $max ]; do
   3.136  		ddq if="$ISO" bs=1024k count=1 skip=$i seek=$i of=$device
   3.137 -		echo $((($i*100)/$max))
   3.138 -		i=$(($i+1))
   3.139 +		echo $(((i*100)/max))
   3.140 +		i=$((i+1))
   3.141  	done | { [ "$1" ] || dialog --gauge \
   3.142  		" The ISO image transfer can be long. Please wait..." \
   3.143  		6 70 0 > /dev/tty 2>&1; }
   3.144 @@ -1255,7 +1255,7 @@
   3.145  	sectors=$(($(sectcnt $device)-1))
   3.146  	quads2bin $sectors | ddq bs=1 seek=458 of=$device	# pmbr
   3.147  	quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
   3.148 -	quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
   3.149 +	quads2bin $((sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
   3.150  	uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device	# partiton fat32
   3.151  begin-base64 644 -
   3.152  H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbz+C/fHwyfEro9Z7E93Fi5/8sH
   3.153 @@ -1264,19 +1264,19 @@
   3.154  EOT
   3.155  	last=$(sectcnt "$ISO")
   3.156  	custom=$((4*$(get 32848 $device 4)))
   3.157 -	[ $custom -gt $(($last-4)) ] && last=$(($custom+4))		# room for cmdline
   3.158 +	[ $custom -gt $((last-4)) ] && last=$((custom+4))		# room for cmdline
   3.159  	quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device	# vfat first address
   3.160 -	quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device	# vfat last address
   3.161 +	quads2bin $((sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device	# vfat last address
   3.162  	quads2bin $(gpt_crc32 1024 $(($(get 596 $device 4)*$(get 592 $device 4)))) | \
   3.163  		ddq bs=1 seek=$((512+88)) of=$device			# CRC32 partitions
   3.164  	ddn of=$device if=$device bs=512 skip=1 seek=$sectors count=1
   3.165 -	ddn of=$device if=$device bs=512 skip=2 seek=$(($sectors-1)) count=1
   3.166 -	quads2bin $sectors 0 1 0 | ddq bs=1 seek=$(($sectors*512+24)) of=$device	# my gpt, alt gpt
   3.167 +	ddn of=$device if=$device bs=512 skip=2 seek=$((sectors-1)) count=1
   3.168 +	quads2bin $sectors 0 1 0 | ddq bs=1 seek=$((sectors*512+24)) of=$device	# my gpt, alt gpt
   3.169  	quads2bin 1 0 $sectors 0 | ddq bs=1 seek=$((512+24)) of=$device	# my gpt, alt gpt
   3.170 -	quads2bin $(($sectors-1)) 0 | ddq bs=1 seek=$(($sectors*512+72)) of=$device
   3.171 +	quads2bin $((sectors-1)) 0 | ddq bs=1 seek=$((sectors*512+72)) of=$device
   3.172  	i=$(get 524 $device 4)
   3.173 -	quads2bin $(gpt_crc32 $(($sectors*512)) $i) | \
   3.174 -		ddq bs=1 seek=$(($sectors*512+16)) of=$device	# CRC32 header
   3.175 +	quads2bin $(gpt_crc32 $((sectors*512)) $i) | \
   3.176 +		ddq bs=1 seek=$((sectors*512+16)) of=$device	# CRC32 header
   3.177  	quads2bin $(gpt_crc32 512 $i) | ddq bs=1 seek=$((512+16)) of=$device	# CRC32 header
   3.178  	partprobe $device
   3.179  	homedev=/dev/$(basename /sys/block/${device#/dev/}/${device#/dev/}*2)
   3.180 @@ -1287,8 +1287,8 @@
   3.181  	i=$(($(get 2 $device) - 1 + ($(get 4 $device) - 1)*512))
   3.182  	i=$(($(od -v -N $i -t u2 -w2 -An $device | \
   3.183  		awk '{ i+= $0 } END { print (i % 65536) }') \
   3.184 -		+ $(get $(($i+1)) $device 1)))
   3.185 -	words2bin $(( (-$i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
   3.186 +		+ $(get $((i+1)) $device 1)))
   3.187 +	words2bin $(( (-i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
   3.188  
   3.189  	[ "$1" ] || $DIALOG --clear --title " Set /home persistent " \
   3.190  			--yes-label "Continue" --yesno \
   3.191 @@ -1343,7 +1343,7 @@
   3.192  {
   3.193  	[ $(get 1024 "$ISO") -eq 35615 ] && n=2 || n=$((1+$(get 417 "$ISO" 1)))
   3.194  	[ $n -eq 4 ] && n=20
   3.195 -	[ $(get $(($n*512)) "$ISO") -eq 35615 ] || n=13
   3.196 +	[ $(get $((n*512)) "$ISO") -eq 35615 ] || n=13
   3.197  	ddq if="$ISO" bs=512 skip=$n count=20 | zcat 2>/dev/null
   3.198  }
   3.199  
   3.200 @@ -1466,7 +1466,7 @@
   3.201  	uudecode <<EOT | ddn of=/tmp/fd$$
   3.202  bootloader
   3.203  EOT
   3.204 -	pos=$(($n*512))
   3.205 +	pos=$((n*512))
   3.206  	if [ -n "$CMDLINE" ]; then
   3.207  		echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
   3.208  		bytes2bin $n | ddn bs=1 seek=497 of=/tmp/fd$$
   3.209 @@ -1476,7 +1476,7 @@
   3.210  	fi
   3.211  	syssize=$(echo $(get 500 /tmp/fd$$ 4))
   3.212  	ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
   3.213 -	ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
   3.214 +	ddq bs=512 count=$(((syssize+31)/32)) conv=sync >> /tmp/fd$$
   3.215  	base=$(size /tmp/fd$$)
   3.216  	len=
   3.217  	if [ "$INITRD" ]; then
   3.218 @@ -1488,54 +1488,54 @@
   3.219  				[ -n "$j" ] && i=$j && break
   3.220  			done
   3.221  			ddq if=$i >> /tmp/fd$$
   3.222 -			l=$(($l+$(size $i)))
   3.223 -			r=$((4 - ($l % 4)))
   3.224 +			l=$((l+$(size $i)))
   3.225 +			r=$((4 - (l % 4)))
   3.226  			if [ $r -ne 4 ]; then
   3.227  				ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
   3.228 -				l=$(($l + $r))
   3.229 +				l=$((l + r))
   3.230  			fi
   3.231  			case "$i:$INITRD" in
   3.232  				*rootfs.gz:*rootfs.gz,*) continue	# loram
   3.233  			esac
   3.234  			len="$len $l"; l=0
   3.235  		done
   3.236 -		rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
   3.237 +		rdadrs=${RDADRS:-$((((syssize*16)+0x1F0000) & -4096))}
   3.238  		quads2bin $rdadrs | ddn bs=1 seek=536 of=/tmp/fd$$
   3.239  	fi
   3.240  	n=$(echo $len | wc -w)
   3.241 -	if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
   3.242 +	if [ $((494 - $(get 494 /tmp/fd$$))) -ge $((n * 4)) ]; then
   3.243  		i=$(($(get 494 /tmp/fd$$)))
   3.244 -		bytes2bin $(($i + ($n*4) - 256)) | ddn bs=1 \
   3.245 +		bytes2bin $((i + (n*4) - 256)) | ddn bs=1 \
   3.246  			seek=496 of=/tmp/fd$$
   3.247  	else
   3.248 -		i=$(($pos + 0x1FC - ($n*4)))
   3.249 -		bytes2bin $(($i % 256)) $((i / 256)) 252 | ddn bs=1 \
   3.250 +		i=$((pos + 0x1FC - (n*4)))
   3.251 +		bytes2bin $((i % 256)) $((i / 256)) 252 | ddn bs=1 \
   3.252  			seek=494 of=/tmp/fd$$
   3.253 -		s=$(($i - 2*$(echo "$SIZES" | wc -w)))
   3.254 -		p=$(($s - $(ifmemcode | wc -c)))
   3.255 +		s=$((i - 2*$(echo "$SIZES" | wc -w)))
   3.256 +		p=$((s - $(ifmemcode | wc -c)))
   3.257  		ifmemcode | ddn bs=1 seek=$p of=/tmp/fd$$
   3.258  		words2bin $SIZES | ddn bs=1 seek=$s of=/tmp/fd$$
   3.259 -		bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
   3.260 +		bytes2bin 154 $((p%256)) $((p/256)) 0 144 | \
   3.261  		ddn bs=1 seek=60 of=/tmp/fd$$
   3.262  	fi
   3.263  	for r in $len ; do
   3.264  		quads2bin $r | ddn bs=1 seek=$i of=/tmp/fd$$
   3.265 -		i=$(($i + 4))
   3.266 +		i=$((i + 4))
   3.267  	done
   3.268  	split -b 1440k /tmp/fd$$ fd$$
   3.269  	rm -f /tmp/fd$$
   3.270  	n=1; i=0; r=0
   3.271  	set -- $len
   3.272  	ls fd$$* | while read file ; do
   3.273 -		if [ $i -ge $(($1+$base)) ]; then
   3.274 -			base=$(($1+$base-$i))
   3.275 +		if [ $i -ge $(($1+base)) ]; then
   3.276 +			base=$(($1+base-i))
   3.277  			shift
   3.278 -			r=$(($r+100)); n=0; i=0
   3.279 +			r=$((r+100)); n=0; i=0
   3.280  		fi
   3.281  		ddq of=$file bs=18k seek=80 count=0
   3.282 -		i=$(($i+1474560))
   3.283 -		printf "mv %s fd%03d.img\n" $file $(($r+$n))
   3.284 -		n=$(($n+1))
   3.285 +		i=$((i+1474560))
   3.286 +		printf "mv %s fd%03d.img\n" $file $((r+n))
   3.287 +		n=$((n+1))
   3.288  	done | sh
   3.289  	du -ch $PWD/fd???.img
   3.290  }