tiny-slitaz diff helper @ rev 30

Add README.md
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Sep 24 12:34:48 2019 +0300 (2019-09-24)
parents cb1743f12df8
children f03cb925353c
line diff
     1.1 --- a/helper	Tue Sep 17 08:38:04 2019 +0200
     1.2 +++ b/helper	Tue Sep 24 12:34:48 2019 +0300
     1.3 @@ -213,14 +213,67 @@
     1.4  
     1.5  
     1.6  
     1.7 -get_suggested()
     1.8 +list_suggested()
     1.9  {
    1.10  	local pkg
    1.11  	pkg=pkgs/$1/receipt
    1.12 -	[ -s $pkg ] || pkg=$2/pkgs/$1/receipt
    1.13 +	TMPDIR=$2
    1.14 +	[ -s $pkg ] || pkg=$TMPDIR/pkgs/$1/receipt
    1.15  	[ -s $pkg ] || pkg=$(get_receipt $@)
    1.16 +	SUGGESTED=
    1.17  	. $pkg
    1.18 -	echo -n $SUGGESTED
    1.19 +	SUGG=
    1.20 +	for i in $SUGGESTED; do
    1.21 +		case " $@ " in
    1.22 +		*\ $i\ *);;
    1.23 +		*) SUGG="$SUGG $i";;
    1.24 +		esac
    1.25 +	done
    1.26 +	if [ "$SUGG" ]; then
    1.27 +		cat <<EOT
    1.28 +	<hr />
    1.29 +	<p>
    1.30 +	You may want to install the following package(s) too:
    1.31 +	</p>
    1.32 +<div class="large">
    1.33 +<table>
    1.34 +	<thead>
    1.35 +		<tr>
    1.36 +			<th> </th>
    1.37 +			<th>Package</th>
    1.38 +			<th>Version</th>
    1.39 +			<th>Description</th>
    1.40 +			<th>Disk</th>
    1.41 +			<th>Memory</th>
    1.42 +			<th> </th>
    1.43 +		</tr>
    1.44 +	</thead>
    1.45 +	<tbody>
    1.46 +EOT
    1.47 +		checked='checked="checked" '
    1.48 +		[ $TMPDIR/uploadconf ] && checked=
    1.49 +		for i in $SUGG; do
    1.50 +			i=$(grep -l "PACKAGE=\"$i\"" pkgs/*/receipt)
    1.51 +			. $i
    1.52 +			cat <<EOT
    1.53 +		<!-- $GROUP -->
    1.54 +		<tr>
    1.55 +			<td><input type="checkbox" name="suggested[]" value="$PACKAGE" $checked /></td>
    1.56 +			<td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">$PACKAGE</a></td>
    1.57 +			<td>$VERSION</td>
    1.58 +			<td>$SHORT_DESC</td>
    1.59 +			<td>$PACKED_SIZE</td>
    1.60 +			<td>$UNPACKED_SIZE</td>
    1.61 +			<td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
    1.62 +		</tr>
    1.63 +EOT
    1.64 +		done
    1.65 +		cat <<EOT
    1.66 +	</tbody>
    1.67 +</table>
    1.68 +</div>
    1.69 +EOT
    1.70 +	fi
    1.71  }
    1.72  
    1.73  
    1.74 @@ -374,6 +427,15 @@
    1.75  }
    1.76  
    1.77  
    1.78 +boot_files()
    1.79 +{
    1.80 +	[ -s $1/fs/boot/bootmenu ] && while read bin button text; do
    1.81 +		cat <<EOT
    1.82 +		<input name="download" value="${button%%,*} ($(du -h \
    1.83 +$1/fs/boot/$bin | awk '{ printf "%s",$1 }'))" type="submit" />
    1.84 +EOT
    1.85 +	done < $1/fs/boot/bootmenu
    1.86 +}
    1.87  
    1.88  
    1.89  lzma_set_size()
    1.90 @@ -395,19 +457,20 @@
    1.91  
    1.92  
    1.93  case "$1" in
    1.94 -	--list-modules)	list_modules $@ ;;
    1.95 -	--list-kernels)	list_kernels $@ ;;
    1.96 -	--list-pkgs)	list_pkgs $@ ;;
    1.97 +	--list-modules)		list_modules $@ ;;
    1.98 +	--list-kernels)		list_kernels $@ ;;
    1.99 +	--list-pkgs)		list_pkgs $@ ;;
   1.100  	--get-form)		get_form $2 $3 ;;
   1.101  	--get-note)		get_note $2 $3 ;;
   1.102 -	--pre-install)	do_pre_install $2 $3 ;;
   1.103 -	--post-install)	do_post_install $2 $3 ;;
   1.104 +	--pre-install)		do_pre_install $2 $3 ;;
   1.105 +	--post-install)		do_post_install $2 $3 ;;
   1.106  	--depends)		get_depends $@ ;;
   1.107 -	--pkgs-extract)	pkgs_extract $2 $3 ;;
   1.108 +	--pkgs-extract)		pkgs_extract $2 $3 ;;
   1.109  	--remove)		rm -rf $2; exit ;;
   1.110  	--get-pkg)		get_package $2 $3 ;;
   1.111 -	--get-suggested)	get_suggested $2 $3 ;;
   1.112 +	--list-suggested)	list_suggested $2 $3 $@ ;;
   1.113  	--init)			init ;;
   1.114 +	--boot-files)		boot_files $2 ;;
   1.115  esac
   1.116  
   1.117  
   1.118 @@ -445,20 +508,16 @@
   1.119  	append initrd=/boot/rootfs rw root=/dev/null vga=normal
   1.120  
   1.121  EOT
   1.122 -	while read bin keys; do
   1.123 -		[ -s $tmp/fs/boot/$bin ] &&
   1.124 -		cp $tmp/fs/boot/$bin $tmp/iso/boot/ &&
   1.125 -		KEY="$KEY ${keys%% *}" &&
   1.126 +	[ -s $tmp/fs/boot/bootmenu ] && while read bin keys text; do
   1.127 +		keys=${keys#*,}
   1.128 +		KEY="$KEY ${keys%%,*}"
   1.129 +		cp $tmp/fs/boot/$bin $tmp/iso/boot/$bin
   1.130  		cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
   1.131 -label $keys
   1.132 +label ${keys//,/ } $bin
   1.133  	kernel /boot/$bin
   1.134  
   1.135  EOT
   1.136 -	done <<EOT
   1.137 -memtest		test memtest mem
   1.138 -ipxe		web zeb ipxe pxe
   1.139 -EOT
   1.140 -	[ -s $tmp/fs/boot/ipxe ] && cp $tmp/fs/boot/ipxe $tmp/iso/boot/ &&
   1.141 +	done < $tmp/fs/boot/bootmenu
   1.142  	[ "$KEY" ] && echo "say You can boot: slitaz (default)$KEY" >> \
   1.143  		$tmp/iso/boot/isolinux/isolinux.cfg
   1.144  	cat >> $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
   1.145 @@ -488,19 +547,14 @@
   1.146  	if [ ! -s out ]; then
   1.147  		cp fs/boot/bzImage slitaz.img
   1.148  		sh fs/boot/bundle slitaz.img rootfs.gz
   1.149 -		if [ -s fs/boot/ipxe ] && [ -s fs/boot/memtest ]; then
   1.150 -			sh fs/boot/bundle out "   SliTaz boot menu" slitaz.img \
   1.151 -				"Tiny SliTaz" fs/boot/ipxe "SliTaz web boot" \
   1.152 -				fs/boot/memtest "Check memory"
   1.153 -		elif [ -s fs/boot/ipxe ]; then
   1.154 -			sh fs/boot/bundle out "   SliTaz boot menu" slitaz.img \
   1.155 -				"Tiny SliTaz" fs/boot/ipxe "SliTaz web boot"
   1.156 -		elif [ -s fs/boot/memtest ]; then
   1.157 -			sh fs/boot/bundle out "   SliTaz boot menu" slitaz.img \
   1.158 -				"Tiny SliTaz" fs/boot/memtest "Check memory"
   1.159 -		else
   1.160 -			mv slitaz.img out
   1.161 -		fi
   1.162 +		if [ -s fs/boot/bootmenu ]; then
   1.163 +			echo -n "sh fs/boot/bundle out '   SliTaz boot menu'"
   1.164 +			echo -n " slitaz.img 'Tiny SliTaz'"
   1.165 +			while read bin button text; do
   1.166 +				echo -n " fs/boot/$bin '$text'"
   1.167 +			done < fs/boot/bootmenu
   1.168 +		fi | sh
   1.169 +		[ -s out ] || mv slitaz.img out
   1.170  	fi
   1.171  	rm -f xa* 2> /dev/null
   1.172  	split -b ${3:-1474560} out