tazusb rev 78

Add many-in-one support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Apr 21 11:13:11 2011 +0200 (2011-04-21)
parents 671df117fb6f
children 0cd9974cbf41
files tazusb
line diff
     1.1 --- a/tazusb	Mon Mar 07 15:39:29 2011 +0000
     1.2 +++ b/tazusb	Thu Apr 21 11:13:11 2011 +0200
     1.3 @@ -232,7 +232,8 @@
     1.4  	mkdir -p /media/cdrom
     1.5  	mount -r -t iso9660 $CDROM /media/cdrom 2>/dev/null
     1.6  	
     1.7 -	if [ ! -f /media/cdrom/boot/rootfs.gz ]; then
     1.8 +	if [ ! -f /media/cdrom/boot/rootfs.gz -a \
     1.9 +	     ! -f /media/cdrom/boot/rootfs1.gz ]; then
    1.10  		echo -e "\nUnable to mount cdrom or to find a filesystem on it (rootfs.gz).\n"
    1.11  		exit 0
    1.12  	fi
    1.13 @@ -257,20 +258,27 @@
    1.14  	echo  "Mounting `basename $ISO`..."
    1.15  	mount $OPTIONS $ISO /media/cdrom 2>/dev/null
    1.16  	
    1.17 -	if [ ! -f /media/cdrom/boot/rootfs.gz ]; then
    1.18 +	if [ ! -f /media/cdrom/boot/rootfs.gz -a \
    1.19 +	     ! -f /media/cdrom/boot/rootfs1.gz ]; then
    1.20  		echo -e "\nUnable to mount iso or to find a filesystem on it (rootfs.gz).\n"
    1.21  		exit 0
    1.22  	fi
    1.23  }
    1.24  
    1.25 -
    1.26  # All needed files are in the boot directory of the cdrom.
    1.27  copy_cdrom_files()
    1.28  {
    1.29  	echo -n "Copying needed files from cdrom..."
    1.30  	mkdir -p $TARGET_ROOT/boot
    1.31  	cp /media/cdrom/boot/bzImage $TARGET_ROOT/boot
    1.32 -	cp /media/cdrom/boot/rootfs.gz $TARGET_ROOT/boot
    1.33 +	rem=0
    1.34 +	for i in $(ls /media/cdrom/boot/rootfs*.gz | sort -r); do
    1.35 +		[ $rem -ne 0 ] && 
    1.36 +			dd if=/dev/zero bs=1 count=$((4 - $rem)) 2> /dev/null
    1.37 +		cat $i
    1.38 +		rem=$(stat -c %s $i)
    1.39 +		rem=$(($rem % 4))
    1.40 +	done > $TARGET_ROOT/boot/rootfs.gz
    1.41  	status
    1.42  }
    1.43  
    1.44 @@ -294,7 +302,7 @@
    1.45  	# Decide if we're installing syslinux or extlinux
    1.46  	if [ "$FSTYPE" = "vfat" ]; then
    1.47  		ST=syslinux
    1.48 -		STC="syslinux -d /boot/syslinux/ $DEVICE"
    1.49 +		STC="syslinux --install -d /boot/syslinux/ $DEVICE"
    1.50  		STE=cfg
    1.51  	else
    1.52  		ST=extlinux
    1.53 @@ -308,7 +316,7 @@
    1.54  	
    1.55  	# Use existing isolinux.cfg for extlinux.conf or syslinux.cfg
    1.56  	cp /media/cdrom/boot/isolinux/isolinux.cfg $TARGET_ROOT/boot/$ST/$ST.$STE
    1.57 -	sed -i -e "s/isolinux.msg/$ST.msg/"	 $TARGET_ROOT/boot/$ST/$ST.$STE
    1.58 +	sed -i "s/isolinux.msg/$ST.msg/"	 $TARGET_ROOT/boot/$ST/$ST.$STE
    1.59  	
    1.60  	# Add home= to append in extlinux or syslinux.cfg
    1.61  	sed -i -e "s/\(append.*\)/\1 home=$UUID/" $(grep -l append $TARGET_ROOT/boot/$ST/*)
    1.62 @@ -333,6 +341,16 @@
    1.63  		sed -i -e "s/isolinux.msg/$ST.msg/" $TARGET_ROOT/boot/$ST/common.inc
    1.64  	fi
    1.65  
    1.66 +	# Un-meta-ize a multi-in-one flavor
    1.67 +	sed -i "s/isolinux/$ST/;s/label slitaz/label multi/" 	 $TARGET_ROOT/boot/$ST/common.cfg
    1.68 +	sed -i 's/\(.*\), flavors.*/                 \1/' \
    1.69 +		$TARGET_ROOT/boot/$ST/$ST.msg
    1.70 +	for i in $TARGET_ROOT/boot/$ST/$ST.$STE $TARGET_ROOT/boot/$ST/??.$STE \
    1.71 +		 $TARGET_ROOT/boot/$ST/??_??.$STE; do
    1.72 +		sed '/label /!d;/label /{s/label .*/label slitaz/;NN;s/rootfs..gz.*gz /rootfs.gz /;N;q}' \
    1.73 +			< $i >> $i
    1.74 +	done
    1.75 +	
    1.76  }
    1.77  
    1.78  # Let user exit or reboot.