tiny-slitaz diff helper @ rev 36

helper: boot bootsector files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 24 17:55:26 2023 +0000 (14 months ago)
parents 798a84e27cc9
children db2cc84a8917
line diff
     1.1 --- a/helper	Tue Jul 13 15:37:38 2021 +0000
     1.2 +++ b/helper	Sun Sep 24 17:55:26 2023 +0000
     1.3 @@ -221,6 +221,7 @@
     1.4  	[ -s $pkg ] || pkg=$TMPDIR/pkgs/$1/receipt
     1.5  	[ -s $pkg ] || pkg=$(get_receipt $@)
     1.6  	SUGGESTED=
     1.7 +	TARGET=i486
     1.8  	. $pkg
     1.9  	SUGG=
    1.10  	for i in $SUGGESTED; do
    1.11 @@ -444,14 +445,16 @@
    1.12  {
    1.13  	n=$(unlzma < $1 | wc -c)
    1.14  	for i in $(seq 1 8); do
    1.15 -		printf '\\\\x%02X' $(($n & 255))
    1.16 -		n=$(($n >> 8))
    1.17 +		printf '\\\\x%02X' $((n & 255))
    1.18 +		n=$((n >> 8))
    1.19  	done | xargs echo -en | dd of=$1 conv=notrunc bs=1 seek=5 2> /dev/null
    1.20  }
    1.21  
    1.22  
    1.23  compressto()
    1.24  {
    1.25 +	[ "$2" == "rootfs" ] && [ -s $tmp/fs/boot/compress_rootfs ] &&
    1.26 +		sh $tmp/fs/boot/compress_rootfs $1 && return
    1.27  	[ "$(which zopfli 2> /dev/null)" ] &&
    1.28  	zopfli --i100 -c /dev/stdin > $1 || gzip -9 > $1
    1.29  	[ "$(which advdef 2> /dev/null)" ] && advdef -z4 $1 > /dev/null
    1.30 @@ -482,21 +485,22 @@
    1.31  	tmp=$2
    1.32  	cd $tmp/fs
    1.33  	[ -s boot/mkrootfs.pre_exec ] && sh boot/mkrootfs.pre_exec
    1.34 -	if [ ! -d boot -a -s ../kernel ]; then # custom kernel
    1.35 +	if [ ! -d boot ] && [ -s ../kernel ]; then # custom kernel
    1.36  		mkdir boot
    1.37  		cp ../kernel boot/bzImage
    1.38  	fi
    1.39 -	find -user bellard -exec chown root.root {} \;
    1.40 -	find | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz
    1.41 +	find . -user bellard -exec chown root.root {} \;
    1.42 +	find . -exec touch {} \;
    1.43 +	find . | grep -v ^./boot | cpio -o -H newc | compressto ../rootfs.gz rootfs
    1.44  fi
    1.45  if [ "x$1" = "x--mkiso" ]; then
    1.46  	tmp=$2
    1.47  	mkdir -p $tmp/iso/boot/isolinux $tmp/iso/data
    1.48 -	cat $tmp/fs/boot/System.map | compressto $tmp/iso/data/sysmap.gz
    1.49 -	cat $tmp/fs/boot/config | compressto $tmp/iso/data/linconf.gz
    1.50 -	cat $tmp/fs/boot/config-busybox | compressto $tmp/iso/data/bbconf.gz
    1.51 +	compressto $tmp/iso/data/sysmap.gz < $tmp/fs/boot/System.map
    1.52 +	compressto $tmp/iso/data/linconf.gz < $tmp/fs/boot/config
    1.53 +	compressto $tmp/iso/data/bbconf.gz < $tmp/fs/boot/config-busybox
    1.54  	cp $tmp/fs/boot/bundle $tmp/iso/data/bundle.sh
    1.55 -	cat $tmp/post_install.log | compressto $tmp/iso/data/log.gz
    1.56 +	compressto $tmp/iso/data/log.gz < $tmp/post_install.log
    1.57  	cp $tmp/config_files $tmp/iso/data/files.cnf
    1.58  	cp $tmp/fs/etc/packages.conf $tmp/iso/data/packages.cnf
    1.59  	[ -s wok/busybox/receipt ] && tar czf $tmp/iso/data/wok.tgz wok/*
    1.60 @@ -514,9 +518,11 @@
    1.61  		keys=${keys#*,}
    1.62  		KEY="$KEY ${keys%%,*}"
    1.63  		cp $tmp/fs/boot/$bin $tmp/iso/boot/$bin
    1.64 +		kernel=kernel
    1.65 +		[ $(stat -c %s $tmp/fs/boot/$bin) -eq 512 ] && kernel=boot
    1.66  		cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
    1.67  label ${keys//,/ } $bin
    1.68 -	kernel /boot/$bin
    1.69 +	$kernel /boot/$bin
    1.70  
    1.71  EOT
    1.72  	done < $tmp/fs/boot/bootmenu