tazlito rev 164

tazlitobox: add Meta tab (for merge)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 17 17:09:34 2010 +0100 (2010-03-17)
parents 72c4b9fd1997
children a81283fde1bd
files tazlitobox
line diff
     1.1 --- a/tazlitobox	Mon Mar 08 18:11:12 2010 +0100
     1.2 +++ b/tazlitobox	Wed Mar 17 17:09:34 2010 +0100
     1.3 @@ -74,6 +74,12 @@
     1.4  		-e "tazlito clean-distro && sleep 1"
     1.5  }
     1.6  
     1.7 +show_flavors()
     1.8 +{
     1.9 +	tazlito list-flavors | \
    1.10 +	awk '{if (show && $1 != "") print $1} /^==/ {show=1}'
    1.11 +}
    1.12 +
    1.13  get_flavor_action()
    1.14  {
    1.15  	cd /home/slitaz
    1.16 @@ -105,6 +111,71 @@
    1.17  	editor $DISTRO_SCRIPT
    1.18  }
    1.19  
    1.20 +merge_input()
    1.21 +{
    1.22 +	set -- $(cat /tmp/tazlito.mergelist 2> /dev/null)
    1.23 +	while [ -n "$2" ]; do
    1.24 +		echo "$2 | $1"
    1.25 +		shift 2
    1.26 +	done
    1.27 +}
    1.28 +
    1.29 +merge_add()
    1.30 +{
    1.31 +	 echo -n " $ISO_IN $ISO_RAM" >> /tmp/tazlito.mergelist
    1.32 +}
    1.33 +
    1.34 +merge_del()
    1.35 +{
    1.36 +	set -- $(cat /tmp/tazlito.mergelist)
    1.37 +	ARGS=""
    1.38 +	while [ -n "$2" ]; do
    1.39 +		case "$1" in
    1.40 +		$ISO_ITEM) ;;
    1.41 +		*)	[ -n "$ARGS" ] && ARGS="$ARGS "
    1.42 +			ARGS="$ARGS$1 $2" ;;
    1.43 +		esac
    1.44 +		shift 2
    1.45 +	done
    1.46 +	echo -n "$ARGS" > /tmp/tazlito.mergelist
    1.47 +}
    1.48 +
    1.49 +merge_args()
    1.50 +{
    1.51 +	first=true
    1.52 +	while [ -n "$2" ]; do
    1.53 +		echo "$(stat -c "%s" $1) $1 $2"
    1.54 +		shift 2
    1.55 +	done | sort -nr | while read size file ram; do
    1.56 +		if $first; then
    1.57 +			cp $file $ISO_OUT
    1.58 +			echo -n "$ram $ISO_OUT "
    1.59 +			first=false
    1.60 +			continue
    1.61 +		fi
    1.62 +		dir=$tmp/$(basename $file)
    1.63 +		mkdir $dir
    1.64 +		mount -o loop,ro $file $dir
    1.65 +		echo -n "$ram $dir/boot/rootfs.gz "
    1.66 +	done
    1.67 +}
    1.68 +
    1.69 +merge_action()
    1.70 +{
    1.71 +	set -- $(cat /tmp/tazlito.mergelist 2> /dev/null)
    1.72 +	rm -f /tmp/tazlito.mergelist
    1.73 +	tmp=/tmp/tazlitobox$$
    1.74 +	mkdir $tmp
    1.75 +	[ -n "$4" ] || return
    1.76 +	xterm -geometry 80x16 -title "build meta iso image $ISO_OUT" \
    1.77 +		-e "script -c 'tazlito merge $(merge_args $@)' && echo -e \"----\nENTER to continue...\" && read close"
    1.78 +	mv $ISO_OUT.merged $ISO_OUT
    1.79 +	for i in $tmp/*; do
    1.80 +		umount -d $i
    1.81 +	done
    1.82 +	rm -rf $tmp
    1.83 +}
    1.84 +
    1.85  # Boxes
    1.86  
    1.87  export HELP='
    1.88 @@ -194,7 +265,7 @@
    1.89  	</pixmap>
    1.90  	</hbox>
    1.91  
    1.92 -	<notebook labels="Writeiso|Live flavor|Flavors list|Gen flavor|Configuration">
    1.93 +	<notebook labels="Writeiso|Live flavor|Flavors list|Gen flavor|Meta|Configuration">
    1.94  
    1.95  	<frame Filesystem to ISO>
    1.96  
    1.97 @@ -210,15 +281,14 @@
    1.98  
    1.99  	<hbox>
   1.100  		<text use-markup="true">
   1.101 -			<label>"<b>Compression (gzip,lzma,none):</b>"</label>
   1.102 +			<label>"<b>Compression:</b>"</label>
   1.103  		</text>
   1.104 -		<entry>
   1.105 -			<default>gzip</default>
   1.106 +		<combobox>
   1.107  			<variable>COMPRESSION</variable>
   1.108 -		</entry>
   1.109 -	</hbox>
   1.110 -
   1.111 -	<hbox>
   1.112 +			<item>gzip</item>
   1.113 +			<item>lzma</item>
   1.114 +			<item>none</item>
   1.115 +		</combobox>
   1.116  		<button>
   1.117  			<label>Writeiso</label>
   1.118  			<input file icon="forward"></input>
   1.119 @@ -358,6 +428,74 @@
   1.120  
   1.121  	</frame>
   1.122  	
   1.123 +	<frame Meta ISO image>
   1.124 +
   1.125 +	<vbox>
   1.126 +		<hbox>
   1.127 +		<text wrap="true" width-chars="33" use-markup="true">
   1.128 +			<label>
   1.129 +"
   1.130 +Combines several ISO flavors like
   1.131 +nested Russian dolls. The amount
   1.132 +of RAM available at startup will be
   1.133 +used to select the good one. "
   1.134 +			</label>
   1.135 +		</text>
   1.136 +
   1.137 +		<tree>
   1.138 +			<width>140</width><height>50</height>
   1.139 +			<label>RAM|ISO</label>
   1.140 +			<variable>ISO_ITEM</variable>
   1.141 +			<input>$BIN merge_input</input>
   1.142 +			<action>$BIN merge_del</action>
   1.143 +			<action>refresh:ISO_ITEM</action>
   1.144 +		</tree>
   1.145 +		</hbox>
   1.146 +		<hbox>
   1.147 +			<text use-markup="true">
   1.148 +				<label>"<b>ISO input: </b> "</label>
   1.149 +			</text>
   1.150 +			<entry accept="filename">
   1.151 +				<variable>ISO_IN</variable>
   1.152 +			</entry>
   1.153 +			<button>
   1.154 +				<input file stock="gtk-open"></input>
   1.155 +				<action type="fileselect">ISO_IN</action>
   1.156 +			</button>
   1.157 +		</hbox>
   1.158 +		<hbox>
   1.159 +			<text use-markup="true">
   1.160 +				<label>"<b>RAM need:</b>  "</label>
   1.161 +			</text>
   1.162 +			<entry>
   1.163 +				<default>128M</default>
   1.164 +				<variable>ISO_RAM</variable>
   1.165 +			</entry>
   1.166 +			<button>
   1.167 +				<input file icon="add"></input>
   1.168 +				<label>"Add ISO"</label>
   1.169 +				<action>$BIN merge_add</action>
   1.170 +				<action>refresh:ISO_ITEM</action>
   1.171 +			</button>
   1.172 +		</hbox>
   1.173 +		<hbox>
   1.174 +			<text use-markup="true">
   1.175 +				<label>"<b>ISO output:</b>"</label>
   1.176 +			</text>
   1.177 +			<entry accept="filename">
   1.178 +				<default>meta.iso</default>
   1.179 +				<variable>ISO_OUT</variable>
   1.180 +			</entry>
   1.181 +			<button>
   1.182 +				<input file icon="go-next"></input>
   1.183 +				<label>"Build ISO"</label>
   1.184 +				<action>$BIN merge_action</action>
   1.185 +			</button>
   1.186 +		</hbox>
   1.187 +	</vbox>
   1.188 +	
   1.189 +	</frame>
   1.190 +	
   1.191  	<frame Flavor config and packages list>
   1.192  
   1.193  	<text wrap="true" width-chars="60" use-markup="true">