tazlito rev 494
stat -m is busybox only (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon May 07 20:42:30 2018 +0200 (2018-05-07) |
parents | f745d3b22418 |
children | da898b26deaf |
files | tazlito |
line diff
1.1 --- a/tazlito Tue May 01 13:01:37 2018 +0200 1.2 +++ b/tazlito Mon May 07 20:42:30 2018 +0200 1.3 @@ -279,6 +279,9 @@ 1.4 for i in $(seq 0 8 24); do 1.5 printf '\\\\x%02X' $((($3 >> $i) & 255)) 1.6 done | xargs echo -en | dd bs=1 conv=notrunc of=$1 seek=$2 2>/dev/null 1.7 + for i in $(seq 0 8 24); do 1.8 + printf '\\\\x%02X' $(((($3*4) >> $i) & 255)) 1.9 + done | xargs echo -en | dd bs=1 conv=notrunc of=$1 seek=$((0x1C+2048*$3)) 2>/dev/null 1.10 } 1.11 1.12 1.13 @@ -312,7 +315,7 @@ 1.14 # Build file list tree 1.15 1.16 ( cd $2 ; find efi -type f -exec echo \ 1.17 - 'stat -c "$(first_block {}) %s f %n" {}' \; | sh | sort -n ) \ 1.18 + 'stat -c "$(busybox stat -m {} | sed q) %s f %n" {}' \; | sh | sort -n ) \ 1.19 >/tmp/fatfiles$$ 1.20 n=$(sed 's/ .*//;q' /tmp/fatfiles$$) 1.21 ( cd $2; find efi ) | awk -v n=$n 'BEGIN { FS="/" } 1.22 @@ -377,7 +380,7 @@ 1.23 c=2 1.24 b16="/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0" 1.25 b14="/0/0/0/0/0/0/0/0/0/0/0/0/0/0" 1.26 - print "EFI /x10" b14 "/x0" c "/0/0/x08/0/0" 1.27 + print "EFI /x10" b14 "/x0" c "/0/0/0/0/0" 1.28 for (n=i=0; i<63; i++) print b16 b16 1.29 } 1.30 { 1.31 @@ -389,7 +392,7 @@ 1.32 } 1.33 END { 1.34 path="efi" 1.35 - d21="/x10" b14 "/x%02X/x%02X/0/x08/0/0\n" 1.36 + d21="/x10" b14 "/x%02X/x%02X/0/0/0/0\n" 1.37 up[0]=0 1.38 s=1 1.39 do { 1.40 @@ -406,7 +409,8 @@ 1.41 else printf x[1] substr(" ",1,8-length(x[1])) 1.42 if (length(x[2]) >= 3) printf substr(x[2],1,3) 1.43 else printf x[2] substr(" ",1,3-length(x[2])) 1.44 - if (type[i] == "d") printf "/x10"; else printf "/0" 1.45 + if (type[i] != "d") printf "/0" 1.46 + else { printf "/x10"; size[i]=0 } 1.47 printf b14 "/x%02X/x%02X",clu[i]%256,clu[i]/256 1.48 printf "/x%02X/x%02X/x%02X/x%02X\n",size[i]%256, 1.49 (size[i]/256)%256,(size[i]/256/256)%256, 1.50 @@ -530,7 +534,7 @@ 1.51 cd $2 1.52 deduplicate 1.53 1.54 - [ $(ls $2/boot/grub* | wc -l) -lt 2 ] && rm -rf $2/boot/grub* 1.55 + [ $(ls $2/boot/grub* 2> /dev/null | wc -l) -lt 2 ] && rm -rf $2/boot/grub* 1.56 make_bzImage_hardlink $2/boot 1.57 alloc_uefi_part $(ls -r $2/boot/vmlinuz*slitaz*) 1.58 1.59 @@ -2053,7 +2057,9 @@ 1.60 # Extract initramfs. 1.61 cd "$TARGET/rootfs" 1.62 action 'Extracting the rootfs...' 1.63 - extract_rootfs "$TARGET/rootcd/boot/$INITRAMFS" "$TARGET/rootfs" 1.64 + for i in $(ls -r $TARGET/rootfs*); do 1.65 + extract_rootfs "$TARGET/rootcd/boot/$INITRAMFS" "$i" 1.66 + done 1.67 # unpack /usr 1.68 for i in etc/tazlito/*.extract; do 1.69 [ -f "$i" ] && . $i ../rootcd