tazlito rev 320

Add tazpanel files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 29 20:20:41 2013 +0200 (2013-06-29)
parents 0051c77af248
children d62d8b8885f6
files Makefile live live.cgi
line diff
     1.1 --- a/Makefile	Mon Jun 17 12:46:34 2013 +0200
     1.2 +++ b/Makefile	Sat Jun 29 20:20:41 2013 +0200
     1.3 @@ -37,8 +37,11 @@
     1.4  	install -m 0755 -d $(DESTDIR)/etc/tazlito
     1.5  	install -m 0644 tazlito.conf $(DESTDIR)/etc/tazlito
     1.6  	install -m 0755 -d $(DESTDIR)/usr/share/doc
     1.7 +	install -m 0755 -d $(DESTDIR)/var/www/tazpanel/menu.d
     1.8  	cp -a applications $(DESTDIR)/usr/share
     1.9  	cp -a doc $(DESTDIR)/usr/share/doc/tazlito
    1.10 +	cp -a live.cgi $(DESTDIR)/var/www/tazpanel
    1.11 +	cp -a live $(DESTDIR)/var/www/tazpanel/menu.d
    1.12  	# i18n
    1.13  	mkdir -p $(DESTDIR)$(PREFIX)/share/locale
    1.14  	cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale
    1.15 @@ -48,9 +51,11 @@
    1.16  uninstall:
    1.17  	rm -f $(PREFIX)/bin/tazlito
    1.18  	rm -f $(PREFIX)/bin/tazlito-wiz
    1.19 -	rm -rf /etc/tazlito
    1.20 -	rm -rf /usr/share/doc/tazlito
    1.21 -	rm -rf /usr/share/applications/tazlito*.desktop
    1.22 +	rm -f $(PREFIX)/var/www/tazpanel/menu.d/live
    1.23 +	rm -f $(PREFIX)/var/www/tazpanel/live.cgi
    1.24 +	rm -rf $(PREFIX)/etc/tazlito
    1.25 +	rm -rf $(PREFIX)/usr/share/doc/tazlito
    1.26 +	rm -rf $(PREFIX)/usr/share/applications/tazlito*.desktop
    1.27  	rm -rf $(PREFIX)/share/locale/*/LC_MESSAGES/tazlito*.mo
    1.28  
    1.29  clean:
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/live	Sat Jun 29 20:20:41 2013 +0200
     2.3 @@ -0,0 +1,11 @@
     2.4 +cat <<EOT
     2.5 +<li><a href="/live.cgi">$(gettext 'Live')</a>
     2.6 +	<ul>
     2.7 +		<li><a href="/live.cgi?liveusb">$(gettext 'Create a live USB key')</a></li>
     2.8 +		<li><a href="/live.cgi#liveiso">$(gettext 'Create a live CD-ROM')</a></li>
     2.9 +		<li><a href="/live.cgi#hybrid">$(gettext 'Create a hybrid ISO')</a></li>
    2.10 +		<li><a href="/live.cgi#loram">$(gettext 'Convert ISO to loram')</a></li>
    2.11 +		<li><a href="/live.cgi#meta">$(gettext 'Build a meta ISO')</a></li>
    2.12 +	</ul>
    2.13 +</li>
    2.14 +EOT
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/live.cgi	Sat Jun 29 20:20:41 2013 +0200
     3.3 @@ -0,0 +1,268 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# CGI interface for SliTaz Live systems using Tazlito and TazUSB.
     3.7 +#
     3.8 +# Copyright (C) 2011 SliTaz GNU/Linux - BSD License
     3.9 +#
    3.10 +
    3.11 +if [ "$1" == "call" ]; then
    3.12 +	case "$2" in
    3.13 +	merge_cleanup)
    3.14 +		mv -f $3.merged $3
    3.15 +		for i in $4/*; do
    3.16 +			umount -d $i
    3.17 +		done
    3.18 +		rm -rf $4
    3.19 +		exit ;;
    3.20 +	esac
    3.21 +fi
    3.22 +
    3.23 +# Common functions from libtazpanel
    3.24 +. lib/libtazpanel
    3.25 +get_config
    3.26 +header
    3.27 +
    3.28 +TITLE=$(gettext 'TazPanel - Live')
    3.29 +
    3.30 +# Build arguments to create a meta iso using 'tazlito merge' command
    3.31 +merge_args()
    3.32 +{
    3.33 +	tmp=$1
    3.34 +	first=true
    3.35 +	i=1
    3.36 +	while [ -n "$(GET input$i)" ]; do
    3.37 +		echo "$(stat -c "%s" $(GET input$i)) $(GET input$i) $(GET ram$i)"
    3.38 +		$((i++))
    3.39 +	done | sort -nr | while read size file ram; do
    3.40 +		if $first; then
    3.41 +			cp $file $(GET metaoutput)
    3.42 +			echo -n "$ram $(GET metaoutput) "
    3.43 +			first=false
    3.44 +			continue
    3.45 +		fi
    3.46 +		dir=$tmp/$(basename $file)
    3.47 +		mkdir $dir
    3.48 +		mount -o loop,ro $file $dir
    3.49 +		echo -n "$ram $dir/boot/rootfs.gz "
    3.50 +	done
    3.51 +}
    3.52 +
    3.53 +#
    3.54 +# Commands executed in Xterm first
    3.55 +#
    3.56 +
    3.57 +case " $(GET) " in
    3.58 +	*\ write_iso\ *)
    3.59 +		$TERMINAL $TERM_OPTS \
    3.60 +			-T "write-iso" \
    3.61 +			-e "tazlito writeiso $(GET write_iso)" & ;;
    3.62 +	*\ loramoutput\ *)
    3.63 +		$TERMINAL $TERM_OPTS \
    3.64 +			-T "build loram iso" \
    3.65 +			-e "tazlito build-loram $(GET input) $(GET loramoutput) $(GET type)" & ;;
    3.66 +	*\ meta\ *)
    3.67 +		tmp=/tmp/$(basename $0).$$
    3.68 +		cleanup="sh $0 call merge_cleanup $(GET output) $tmp"
    3.69 +		$TERMINAL $TERM_OPTS \
    3.70 +			-T "build meta iso" \
    3.71 +			-e "tazlito merge $(merge_args $tmp); \
    3.72 +				gettext 'ENTER to quit'; read i; \
    3.73 +				$cleanup" & ;;
    3.74 +	*\ hybrid\ *)
    3.75 +		$TERMINAL $TERM_OPTS \
    3.76 +			-T "build hybrid iso" \
    3.77 +			-e "iso2exe $(GET input)" & ;;
    3.78 +esac
    3.79 +
    3.80 +#
    3.81 +# Commands
    3.82 +#
    3.83 +
    3.84 +case " $(GET) " in
    3.85 +	*\ create\ *)
    3.86 +		#
    3.87 +		# Create a flavor file and ISO in options with all settings
    3.88 +		# Step by step interface and store files in cache.
    3.89 +		#
    3.90 +		gettext 'TODO' ;;
    3.91 +	*\ liveusb\ *)
    3.92 +		xhtml_header
    3.93 +		cat << EOT
    3.94 +<div id="wrapper">
    3.95 +	<h2>$(gettext 'SliTaz LiveUSB')</h2>
    3.96 +	<p>$(gettext 'Create Live USB SliTaz systems')<p>
    3.97 +</div>
    3.98 +
    3.99 +<p>$(gettext "Generate SliTaz LiveUSB media and boot in RAM! Insert a LiveCD \
   3.100 +into the cdrom drive, select the correct device and press Generate.")</p>
   3.101 +
   3.102 +<form method="get" action="$SCRIPT_NAME">
   3.103 +	<input type="hidden" name="liveusb" />
   3.104 +	$(gettext 'USB Media to use:')
   3.105 +	<select name="gen">
   3.106 +EOT
   3.107 +		# List disk if there is a plugged USB device
   3.108 +		if [ -d /proc/scsi/usb-storage ]; then
   3.109 +			for i in `blkid | cut -d ":" -f 1`; do
   3.110 +				echo "<option value='$i'>$i</option>"
   3.111 +			done
   3.112 +		else
   3.113 +			echo "<option value="">$(gettext 'Not found')</option>"
   3.114 +		fi
   3.115 +		cat << EOT
   3.116 +	</select>
   3.117 +	<input type="submit" value="$(gettext 'Generate')" />
   3.118 +</form>
   3.119 +EOT
   3.120 +		if [ "$(GET gen)" ]; then
   3.121 +			cat << EOT
   3.122 +<h3>tazusb gen-liveusb $(GET gen)</h3>
   3.123 +<pre>
   3.124 +EOT
   3.125 +			# No pipe here so output is displayed in realtime
   3.126 +			yes | tazusb gen-liveusb $(GET gen)
   3.127 +			echo '</pre>'
   3.128 +		fi ;;
   3.129 +	*)
   3.130 +		#
   3.131 +		# Default xHTML content
   3.132 +		#
   3.133 +		xhtml_header
   3.134 +		cat << EOT
   3.135 +<div id="wrapper">
   3.136 +	<h2>$(gettext 'SliTaz Live Systems')</h2>
   3.137 +	<p>$(gettext 'Create and manage Live CD or USB SliTaz systems')<p>
   3.138 +</div>
   3.139 +
   3.140 +<div id="actions">
   3.141 +	<a class="button" href="$SCRIPT_NAME?liveusb">
   3.142 +		<img src="$IMAGES/harddisk.png" />$(gettext 'Create LiveUSB')</a>
   3.143 +</div>
   3.144 +
   3.145 +
   3.146 +<!--
   3.147 +<h3 id="livecd">$(gettext 'Write a Live CD')</h3>
   3.148 +
   3.149 +<p>$(gettext "The command writeiso will generate an ISO image of the current \
   3.150 +filesystem as is, including all files in the /home directory. It is an easy \
   3.151 +way to remaster a SliTaz Live system, you just have to: boot, modify, \
   3.152 +writeiso.")</p>
   3.153 +
   3.154 +<form method="get" action="$SCRIPT_NAME">
   3.155 +	$(gettext 'Compression type:')
   3.156 +	<select name="write_iso">
   3.157 +		<option value="gzip">gzip</option>
   3.158 +		<option value="lzma">lzma</option>
   3.159 +		<option value="none">$(gettext 'none')</option>
   3.160 +	</select>
   3.161 +	<input type="submit" value="$(gettext 'Write ISO')" />
   3.162 +</form> -->
   3.163 +
   3.164 +
   3.165 +<h3>$(gettext 'Live CD tools')</h3>
   3.166 +
   3.167 +<h4 id="loram">$(gettext 'Convert ISO to loram')</h4>
   3.168 +
   3.169 +<p>$(gettext "This command will convert an ISO image of a SliTaz Live CD to a \
   3.170 +new ISO image requiring less RAM to run.")</p>
   3.171 +
   3.172 +<form method="get" action="$SCRIPT_NAME#loram">
   3.173 +	<table>
   3.174 +		<tr>
   3.175 +			<td>$(gettext 'ISO to convert')
   3.176 +				<input type="text" accept=".iso" name="input" value="/root/" /></td>
   3.177 +		</tr>
   3.178 +		<tr>
   3.179 +			<td><input type="radio" name="type" value="ram" id="type1" checked />
   3.180 +				<label for="type1">$(gettext 'The filesystem is always in RAM')</label>
   3.181 +			</td>
   3.182 +		</tr>
   3.183 +		<tr>
   3.184 +			<td><input type="radio" name="type" value="smallcdrom" id="type2" />
   3.185 +				<label for="type2">$(gettext 'The filesystem may be on a small CDROM')</label>
   3.186 +			</td>
   3.187 +		</tr>
   3.188 +		<tr>
   3.189 +			<td><input type="radio" name="type" value="cdrom" id="type3" />
   3.190 +				<label for="type3">$(gettext 'The filesystem may be on a large CDROM')</label>
   3.191 +			</td>
   3.192 +		</tr>
   3.193 +		<tr>
   3.194 +			<td>$(gettext 'ISO to create')
   3.195 +				<input type="text" accept=".iso" name="loramoutput" value="/root/loram.iso" />
   3.196 +			</td>
   3.197 +		</tr>
   3.198 +	</table>
   3.199 +	<input type="submit" value="$(gettext 'Convert ISO to loram')" />
   3.200 +</form>
   3.201 +
   3.202 +
   3.203 +<h4 id="hybrid">$(gettext 'Build a hybrid ISO')</h4>
   3.204 +
   3.205 +<p>$(gettext "Add a master boot sector and a EXE header to the ISO image. \
   3.206 +")</p>
   3.207 +
   3.208 +<form method="get" action="$SCRIPT_NAME#hybrid">
   3.209 +	<table>
   3.210 +	<tr>
   3.211 +	<td>
   3.212 +	$(gettext 'ISO to convert')
   3.213 +	<input type="text" name="input" value="/root/" />
   3.214 +	</td>
   3.215 +	</tr>
   3.216 +	</table>
   3.217 +	<input type="submit" name="hybrid" value="$(gettext 'Build a hybrid ISO')" />
   3.218 +</form>
   3.219 +
   3.220 +<h4 id="meta">$(gettext 'Build a meta ISO')</h4>
   3.221 +
   3.222 +<p>$(gettext "Combines several ISO flavors like nested Russian dolls. The \
   3.223 +amount of RAM available at startup will be used to select the utmost one.")</p>
   3.224 +
   3.225 +<form method="get" action="$SCRIPT_NAME#meta">
   3.226 +	<table>
   3.227 +EOT
   3.228 +		i=""
   3.229 +		while [ -n "$(GET addmeta)" ]; do
   3.230 +			[ -n "$(GET input$i)" ] || break
   3.231 +			j=$(($i + 1))
   3.232 +			cat << EOT
   3.233 +		<tr>
   3.234 +			<td>$(gettext 'ISO number') $j: $(GET input$i)
   3.235 +				<input type="hidden" name="input$j" value="$(GET input$i)" />
   3.236 +			</td>
   3.237 +			<td>$(gettext 'Minimum RAM'): $(GET ram$i)
   3.238 +				<input type="hidden" name="ram$j" value="$(GET ram$i)" />
   3.239 +			</td>
   3.240 +		</tr>
   3.241 +EOT
   3.242 +			i=$j
   3.243 +		done
   3.244 +		metaoutput="$(GET metaoutput)"
   3.245 +		[ -n "$metaoutput" ] || metaoutput="/root/meta.iso"
   3.246 +
   3.247 +		cat << EOT
   3.248 +		<tr>
   3.249 +			<td>$(gettext 'ISO to add')
   3.250 +				<input type="text" name="input" value="/root/" />
   3.251 +			</td>
   3.252 +			<td>$(gettext 'Minimum RAM')
   3.253 +				<input type="text" name="ram" value="128M" />
   3.254 +				<input type="submit" name="addmeta" value="$(gettext 'Add to the list')" />
   3.255 +			</td>
   3.256 +		</tr>
   3.257 +		<tr>
   3.258 +			<td>$(gettext 'ISO to create')
   3.259 +				<input type="text" name="metaoutput" value="$metaoutput" />
   3.260 +			</td>
   3.261 +		</tr>
   3.262 +	</table>
   3.263 +	<input type="submit" name="meta" value="$(gettext 'Build a meta ISO')" />
   3.264 +</form>
   3.265 +
   3.266 +EOT
   3.267 +		;;
   3.268 +esac
   3.269 +
   3.270 +xhtml_footer
   3.271 +exit 0