tazlito rev 531 tip

tazlito: hexdump -R may not by supported in busybox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jun 18 13:45:55 2021 +0000 (4 months ago)
parents 668f2e7befb0
children
files tazlito
line diff
     1.1 --- a/tazlito	Wed Nov 18 09:07:41 2020 +0000
     1.2 +++ b/tazlito	Fri Jun 18 13:45:55 2021 +0000
     1.3 @@ -173,6 +173,11 @@
     1.4  }
     1.5  
     1.6  
     1.7 +hexdump_R() {
     1.8 +	sed '/ /!d;s/  |.*//;s| *$||;s|  *|\\\\x|g;s|^[^\\]*|busybox echo -en |' | sh
     1.9 +}
    1.10 +
    1.11 +
    1.12  # Download a file from this mirror
    1.13  
    1.14  download_from() {
    1.15 @@ -455,7 +460,7 @@
    1.16        printf "0  %02X %02X %02X %02X |\n",c[i+1]%256,(c[i+1]/256)%256,(c[i+1]/65536)%256,(c[i+1]/16777216)%256
    1.17      }
    1.18    }
    1.19 -}' | hexdump -R | dd of="$1" seek=$((4*$efiblock+$fatsz+$resv)) \
    1.20 +}' | hexdump_R | dd of="$1" seek=$((4*$efiblock+$fatsz+$resv)) \
    1.21  		conv=notrunc bs=512 > /dev/null 2>&1
    1.22  	dd if="$1" of="$1" conv=notrunc bs=512 skip=$((4*$efiblock+$fatsz+$resv)) \
    1.23  		count=$fatsz seek=$((4*$efiblock+$resv)) > /dev/null 2>&1
    1.24 @@ -555,7 +560,7 @@
    1.25  	# Create boot sector
    1.26  	doslabel="$(echo "SLITAZ BOOT         " | od -v -N 11 -t x1 -w1 -An)"
    1.27  	if [ "$ftype" = "33 32" ]; then
    1.28 -		hexdump -R <<EOT | dd of=$basedir/$efi_img \
    1.29 +		hexdump_R <<EOT | dd of=$basedir/$efi_img \
    1.30  			conv=notrunc
    1.31  0  eb 58 90 53 6c 69 54 61  7a 00 00 00 02 04 $rsect 00  |
    1.32  0  02 00 00 $size f8 00 00  20 00 40 00 00 00 00 00  |
    1.33 @@ -565,7 +570,7 @@
    1.34  0        46 41 54 $ftype 20 20 20 cd 18 cd 19 eb fa  |
    1.35  EOT
    1.36  		while read ofs data; do
    1.37 -			echo "0 ${data//:/ } |" | hexdump -R | dd conv=notrunc \
    1.38 +			echo "0 ${data//:/ } |" | hexdump_R | dd conv=notrunc \
    1.39  			bs=1 seek=$ofs of=$basedir/$efi_img
    1.40  		done <<EOT
    1.41  510	55:aa:52:52:61:41
    1.42 @@ -575,7 +580,7 @@
    1.43  	else
    1.44  		echo -en '\x55\xAA' | dd of=$basedir/$efi_img \
    1.45  			seek=510 bs=1 conv=notrunc
    1.46 -		hexdump -R <<EOT | dd of=$basedir/$efi_img \
    1.47 +		hexdump_R <<EOT | dd of=$basedir/$efi_img \
    1.48  			conv=notrunc
    1.49  0  eb 3c 90 53 6c 69 54 61  7a 00 00 00 02 04 $rsect 00  |
    1.50  0  02 40 00 $size f8 $fsz   20 00 40 00 00 00 00 00  |
    1.51 @@ -586,13 +591,13 @@
    1.52  	fi 2> /dev/null
    1.53  
    1.54  	# Create fats
    1.55 -	echo "0  $fhead |" | hexdump -R | dd of=$basedir/$efi_img \
    1.56 +	echo "0  $fhead |" | hexdump_R | dd of=$basedir/$efi_img \
    1.57  		seek=$(($rsect)) bs=512 conv=notrunc 2> /dev/null
    1.58 -	echo "0  $fhead |" | hexdump -R | dd of=$basedir/$efi_img \
    1.59 +	echo "0  $fhead |" | hexdump_R | dd of=$basedir/$efi_img \
    1.60  		seek=$(($rsect+$fsect)) bs=512 conv=notrunc 2> /dev/null
    1.61  
    1.62  	# Add label
    1.63 -	echo "0  $doslabel 08 |" | hexdump -R | \
    1.64 +	echo "0  $doslabel 08 |" | hexdump_R | \
    1.65  		dd of=$basedir/$efi_img bs=512 conv=notrunc \
    1.66  		seek=$(($rsect+$fsect+$fsect)) 2> /dev/null
    1.67  
    1.68 @@ -654,7 +659,7 @@
    1.69  $PWD/$efi_img
    1.70  $PWD/boot/bzImage*
    1.71  $PWD/efi/boot/linux.cmdline*
    1.72 -$PWD/boot/rootfs*
    1.73 +$(ls $PWD/boot/rootfs* | tac)
    1.74  EOT
    1.75  
    1.76  	action 'Computing md5...'
    1.77 @@ -1351,9 +1356,9 @@
    1.78  	else
    1.79  		[ ! -f /usr/sbin/mksquashfs ] && ! install_package squashfs && return 1
    1.80  		for v in $version ; do
    1.81 -			while [ ! -f /lib/modules/$v/kernel/fs/squashfs/squashfs.ko.?z ]; do
    1.82 +			if [ ! -f /lib/modules/$v/kernel/fs/squashfs/squashfs.ko.?z ]; then
    1.83  				install_package linux-squashfs $v || return 1
    1.84 -			done
    1.85 +			fi
    1.86  		done
    1.87  		for v in $version ; do
    1.88  			cp /lib/modules/$v/kernel/fs/squashfs/squashfs.ko.?z \