tazlito rev 235

tazlito/meta: add vesamenu support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 14 09:31:32 2012 +0100 (2012-02-14)
parents e6839ebfb5c7
children 962315889ccd
files tazlito
line diff
     1.1 --- a/tazlito	Sun Feb 12 15:01:28 2012 +0100
     1.2 +++ b/tazlito	Tue Feb 14 09:31:32 2012 +0100
     1.3 @@ -276,10 +276,10 @@
     1.4  		exit 0
     1.5  	fi
     1.6  	# Set date for boot msg.
     1.7 -	if grep -q 'XXXXXXXX' $ROOTCD/boot/isolinux/isolinux.cfg; then
     1.8 +	if grep -q 'XXXXXXXX' $ROOTCD/boot/isolinux/isolinux.*g; then
     1.9  		DATE=`date +%Y%m%d`
    1.10  		echo -n "Setting build date to: $DATE..."
    1.11 -		sed -i s/'XXXXXXXX'/"$DATE"/ $ROOTCD/boot/isolinux/isolinux.cfg
    1.12 +		sed -i "s/XXXXXXXX/$DATE/" $ROOTCD/boot/isolinux/isolinux.*g
    1.13  		status
    1.14  	fi
    1.15  	cd $ROOTCD
    1.16 @@ -575,9 +575,10 @@
    1.17  # Update isolinux config files for multiple rootfs
    1.18  update_bootconfig()	
    1.19  {
    1.20 +	local files
    1.21  	echo -n "Updating boot config files..."
    1.22 -	grep -l 'include common' $1/*.cfg | \
    1.23 -	while read file ; do
    1.24 +	files="$(grep -l 'include common' $1/*.cfg)"
    1.25 +	echo $files | while read file ; do
    1.26  			awk -v n=$(echo $2 | awk '{ print NF/2 }') '{
    1.27  if (/label/) label=$0;
    1.28  else if (/kernel/) kernel=$0;
    1.29 @@ -602,20 +603,61 @@
    1.30  }' < $file > $file.$$
    1.31  			mv -f $file.$$ $file
    1.32  	done
    1.33 +	sel="$(echo $2 | awk '{
    1.34 +  for (i=1; i<=NF; i++)
    1.35 +     if (i % 2 == 0) printf " slitaz%d",i/2
    1.36 +     else printf " %s",$i
    1.37 +}')"
    1.38  	cat >> $1/common.cfg <<EOT
    1.39  
    1.40  label slitaz
    1.41  	kernel /boot/isolinux/ifmem.c32
    1.42 -	append$(echo $2 | awk '{
    1.43 -  for (i=1; i<=NF; i++)
    1.44 -     if (i % 2 == 0) printf " slitaz%d",i/2
    1.45 -     else printf " %s",$i
    1.46 -}') noram
    1.47 +	append$sel noram
    1.48  
    1.49  label noram
    1.50  	config noram.cfg
    1.51  
    1.52  EOT
    1.53 +	# Update vesamenu
    1.54 +	if [ -s $1/isolinux.cfg ]; then
    1.55 +		files="$files $1/isolinux.cfg"
    1.56 +		awk -v n=$(echo $2 | awk '{ print NF/2 }') -v "sel=$sel" '{
    1.57 +if (/ROWS/) print "MENU ROW " n+$3;
    1.58 +else if (/TIMEOUTROW/) print "MENU TIMEOUTROW " n+$3;
    1.59 +else if (/TABMSGROW/) print "MENU TABMSGROW " n+$3;
    1.60 +else if (/CMDLINEROW/) print "MENU CMDLINEROW " n+$3;
    1.61 +else if (/VSHIFT/) {
    1.62 +	x=$3-n;
    1.63 +	if (x < 0) x=0;
    1.64 +	print "MENU VSHIFT " x;
    1.65 +}
    1.66 +else if (/bzImage/) kernel=$0;
    1.67 +else if (/rootfs.gz/) {
    1.68 +	i=index($0,"rootfs.gz");
    1.69 +	append=substr($0,i+9);
    1.70 +	print	"	kernel /boot/isolinux/ifmem.c32"
    1.71 +	print	"	append" sel " noram"
    1.72 +	print	""
    1.73 +	print	"label noram"
    1.74 +	print	"	MENU HIDE"
    1.75 +	print	"	config noram.cfg"
    1.76 +	print	""
    1.77 +	for (i = 1; i <= n; i++) {
    1.78 +		print "LABEL slitaz" i
    1.79 +		print "	MENU LABEL SliTaz slitaz" i " Live"
    1.80 +		print kernel;
    1.81 +		initrd="initrd=/boot/rootfs" n ".gz"
    1.82 +		for (j = n - 1; j >= i; j--) {
    1.83 +			initrd=initrd ",/boot/rootfs" j ".gz";
    1.84 +		}
    1.85 +		printf "\tappend %s%s\n",initrd,append;
    1.86 +		print "";
    1.87 +	}
    1.88 +}
    1.89 +else print;
    1.90 +}' < $1/isolinux.cfg > $1/isolinux.cfg.$$
    1.91 +		mv $1/isolinux.cfg.$$ $1/isolinux.cfg
    1.92 +	fi
    1.93  	cat > $1/noram.cfg <<EOT
    1.94  display isolinux.msg
    1.95  say Not enough RAM to boot slitaz.
    1.96 @@ -636,8 +678,7 @@
    1.97  	# Restore real label names
    1.98  	echo $2 | awk '{ for (i=NF; i>1; i-=2) printf "%d/%s\n",i/2,$i }' | \
    1.99  	while read pat; do
   1.100 -		sed -i "s/slitaz$pat/" $1/common.cfg \
   1.101 -			$(grep -l 'include common' $1/*.cfg)
   1.102 +		sed -i "s/slitaz$pat/" $1/common.cfg $files
   1.103  	done
   1.104  	status
   1.105  }
   1.106 @@ -2131,7 +2172,7 @@
   1.107  			status
   1.108  		fi
   1.109  		# Isolinux msg	
   1.110 -		if grep -q "cooking-XXXXXXXX" /$ROOTCD/boot/isolinux/isolinux.msg; then
   1.111 +		if grep -q "cooking-XXXXXXXX" /$ROOTCD/boot/isolinux/isolinux.*g; then
   1.112  			echo -n "Isolinux msg : Missing cooking date XXXXXXXX (ex `date +%Y%m%d`)"
   1.113  			todomsg
   1.114  		else