slitaz-pizza diff web/rootfs.cgi @ rev 126

Fix again help (rename to helper and it works...) up skel
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 16 18:45:22 2017 +0100 (2017-03-16)
parents 57a95ac66802
children
line diff
     1.1 --- a/web/rootfs.cgi	Sat Mar 01 08:21:48 2014 +0000
     1.2 +++ b/web/rootfs.cgi	Thu Mar 16 18:45:22 2017 +0100
     1.3 @@ -15,48 +15,48 @@
     1.4  # Handle rootfs.* file upload.
     1.5  tarball_handler() {
     1.6  	echo "<pre>"
     1.7 -	echo "File name : $tarball"
     1.8 -	echo "File size : $size Bytes"
     1.9 -	gettext "Moving rootfs tarball to slitaz-$id"
    1.10 +	eval_gettext 'File name: $tarball'
    1.11 +	eval_gettext 'File size: $size Bytes'
    1.12 +	eval_gettext 'Moving rootfs tarball to slitaz-$id...'
    1.13  	upload=$tmpdir/slitaz-$id/upload-$$
    1.14  	mkdir -p $upload && cd $upload
    1.15  	mv $tmpname "$upload/$tarball" && rm -rf $(dirname $tmpname)
    1.16  	chmod a+r $upload/$tarball
    1.17  	status
    1.18 -	
    1.19 +
    1.20  	# Extract into the tmp upload dir.
    1.21 -	gettext "Extracting archive for sanity checks..."
    1.22 +	gettext 'Extracting archive for sanity checks...'
    1.23  	case "$tarball" in
    1.24  		*.tar.gz) tar xzf $tarball && status ;;
    1.25  		*.tar.bz2) tar xjf $tarball && status ;;
    1.26  		*.tar.lzma) tar xaf $tarball && status ;;
    1.27 -		*) echo && error "Unsupported tarball format" && rm -rf $upload
    1.28 +		*) echo; error 'Unsupported tarball format'; rm -rf $upload
    1.29  	esac
    1.30 -	
    1.31 -	# Upload dir is removed if bad tarball so we stop here. Now be a bit
    1.32 +
    1.33 +	# Upload dir is removed if bad tarball, so we stop here. Now be a bit
    1.34  	# restrictive using only rootfs as archive name and check FSH in root.
    1.35 -	# Dont allow files in /dev /proc /sys /tmp /mnt
    1.36 +	# Don't allow files in /dev /proc /sys /tmp /mnt
    1.37  	if [ -d "$upload/rootfs" ]; then
    1.38 -		gettext "Checking Filesystem Standard..."
    1.39 +		gettext 'Checking Filesystem Standard...'
    1.40  		for i in $(ls $upload/rootfs)
    1.41  		do
    1.42  			case "$i" in
    1.43  				bin|boot|etc|home|init|lib|root|sbin|usr|var) continue ;;
    1.44 -				*) echo "Bad FSH path for: $i" && rm -rf $upload ;;
    1.45 +				*) eval_gettext 'Bad FSH path for: $i'; rm -rf $upload ;;
    1.46  			esac
    1.47  		done && status
    1.48 -		# Dont allow too big rootfs content.
    1.49 +		# Don't allow too big rootfs content.
    1.50  		size=$(du -s $upload/rootfs | awk '{print $1}')
    1.51 -		gettext "Checking uploaded rootfs size..."
    1.52 +		gettext 'Checking uploaded rootfs size...'
    1.53  		if [ "$size" -lt "$MAX_UPLOAD" ]; then
    1.54  			status
    1.55  		else
    1.56 -			echo && error "Tarball is too big"
    1.57 +			echo; error 'Tarball is too big'
    1.58  			rm -rf $upload
    1.59  		fi
    1.60  	fi
    1.61  	
    1.62 -	# So now it time to move the addfile to flavor files.
    1.63 +	# So, now it time to move the addfile to flavor files.
    1.64  	if [ -d "$upload/rootfs" ]; then
    1.65  		echo "Additional rootfs: accepted" | tee -a $log
    1.66  		mkdir -p $tmpdir/slitaz-$id/rootfs
    1.67 @@ -81,9 +81,9 @@
    1.68  			mkdir -p $images
    1.69  			mv $tmpname $images/slitaz-background.jpg
    1.70  			chmod a+r $images/*.jpg
    1.71 -			notify "$(gettext "Added image:") $wallpaper ($size Bytes)"
    1.72 +			notify "$(eval_gettext 'Added image: $wallpaper ($size Bytes)')"
    1.73  		else
    1.74 -			notify "$(gettext "Unsupported image format")" "error"
    1.75 +			notify "$(gettext 'Unsupported image format')" "error"
    1.76  		fi ;;
    1.77  	*\ desktop\ *)
    1.78  		id="$(POST id)"
    1.79 @@ -93,12 +93,12 @@
    1.80  		path="$tmpdir/slitaz-$id/rootfs/etc/skel/Desktop"
    1.81  		mkdir -p $path
    1.82  		case "$file" in
    1.83 -			*README*|*.desktop|*.html|*.png|*.jpg) 
    1.84 +			*README*|*.desktop|*.html|*.png|*.jpg)
    1.85  				mv $tmpname $path/$file
    1.86  				chmod a+r $path/$file
    1.87 -				notify "$(gettext "Added file:") $file ($size Bytes)" ;;
    1.88 -			*) 
    1.89 -				notify "$(gettext "Unsupported file type")" "error" ;;
    1.90 +				notify "$(gettext 'Added file: $file ($size Bytes)')" ;;
    1.91 +			*)
    1.92 +				notify "$(gettext 'Unsupported file type')" "error" ;;
    1.93  		esac
    1.94  		;;
    1.95  	*\ tarball\ *)
    1.96 @@ -113,7 +113,7 @@
    1.97  
    1.98  if [ "$(POST fastboot)" != "" ]; then
    1.99  	echo "Fast boot conversion" >> $log
   1.100 -	notify "$(gettext "Fast boot conversion")"
   1.101 +	notify "$(gettext 'Fast boot conversion')"
   1.102  	mkdir -p $tmpdir/slitaz-$id/rootfs/etc/tazlito 2> /dev/null
   1.103  	# lzo decompression crash with 2.6.37...
   1.104  	false && cat > $tmpdir/slitaz-$id/rootfs/etc/tazlito/fastboot.iso <<EOT
   1.105 @@ -132,7 +132,7 @@
   1.106  
   1.107  if [ "$(POST loram)" != "none" ] && [ "$(POST loram)" != "" ]; then
   1.108  	echo "Low RAM conversion: $(POST loram)" >> $log
   1.109 -	notify "$(gettext "Low RAM conversion:") $(POST loram)"
   1.110 +	notify "$(gettext 'Low RAM conversion:') $(POST loram)"
   1.111  	mkdir -p $tmpdir/slitaz-$id/rootfs/etc/tazlito 2> /dev/null
   1.112  	rm -f $tmpdir/slitaz-$id/rootfs/etc/tazlito/fastboot.iso 2> /dev/null
   1.113  	cat > $tmpdir/slitaz-$id/rootfs/etc/tazlito/loram.final <<EOT
   1.114 @@ -154,12 +154,12 @@
   1.115  #
   1.116  . $tmpdir/slitaz-$id/receipt
   1.117  cat << EOT
   1.118 -<h2>Rootfs</h2>
   1.119 +<h2>RootFS</h2>
   1.120  <form method="post" action="rootfs.cgi" enctype="multipart/form-data">
   1.121  
   1.122  <p>
   1.123 -	SliTaz root filesystem modification can be done via an easy to use form,
   1.124 -	a single tarball or by uploading files one by one in the wanted directory.
   1.125 +$(gettext "SliTaz root filesystem modification can be done via an easy to use form, \
   1.126 +a single tarball or by uploading files one by one in the wanted directory.")
   1.127  </p>
   1.128  
   1.129  <h3>$(gettext "Easy customization")</h3>
   1.130 @@ -173,11 +173,11 @@
   1.131  		<input type="file" name="wallpaper" size="48" />
   1.132  	</div>
   1.133  </div>
   1.134 -<input type="submit" value="Upload Image" style="margin-left: 6px;" />
   1.135 +<input type="submit" value="$(gettext 'Upload Image')" style="margin-left: 6px;" />
   1.136  
   1.137  <p>
   1.138 -$(gettext "Files on user desktop such as README, desktop files or documentation.
   1.139 -The files will be copied in the Home directory of each new user. SliTaz creates
   1.140 +$(gettext "Files on user desktop such as README, desktop files or documentation. \
   1.141 +The files will be copied in the Home directory of each new user. SliTaz creates \
   1.142  the default Live user at boot. Allowed files and extensions are:") README 
   1.143  .desktop .html .png .jpg:
   1.144  <p>
   1.145 @@ -187,17 +187,17 @@
   1.146  		<input type="file" name="desktop" size="48" />
   1.147  	</div>
   1.148  </div>
   1.149 -<input type="submit" value="Upload File" style="margin-left: 6px;" />
   1.150 +<input type="submit" value="$(gettext 'Upload File')" style="margin-left: 6px;" />
   1.151  
   1.152  
   1.153 -<h3>$(gettext "Rootfs tarball")</h3>
   1.154 +<h3>$(gettext "RootFS tarball")</h3>
   1.155  <p>
   1.156 -	The files in the rootfs archive must have the same directory structure
   1.157 -	as any standard SliTaz or Linux system. For example if you wish to
   1.158 -	have a custom boot configuration file, you will have: rootfs/etc/rcS.conf.
   1.159 -	Accepted tarball formats are: <strong>tar.gz tar.bz2 tar.lzma</strong>
   1.160 -	and the archived directory must be named rootfs with a valid file system
   1.161 -	hierachy such as: /usr/bin /etc /var/www
   1.162 +$(gettext "The files in the rootfs archive must have the same directory structure \
   1.163 +as any standard SliTaz or Linux system. For example if you wish to \
   1.164 +have a custom boot configuration file, you will have: rootfs/etc/rcS.conf. \
   1.165 +Accepted tarball formats are: <strong>tar.gz tar.bz2 tar.lzma</strong> \
   1.166 +and the archived directory must be named rootfs with a valid file system \
   1.167 +hierachy such as: /usr/bin /etc /var/www")
   1.168  </p>
   1.169  
   1.170  <div class="inputfile">
   1.171 @@ -205,7 +205,7 @@
   1.172  		<input type="file" name="tarball" size="48" />
   1.173  	</div>
   1.174  </div>
   1.175 -<input type="submit" value="Upload rootfs" style="margin-left: 6px;" />
   1.176 +<input type="submit" value="$(gettext 'Upload rootFS')" style="margin-left: 6px;" />
   1.177  
   1.178  <h3>$(gettext "ISO image conversion")</h3>
   1.179  
   1.180 @@ -215,10 +215,10 @@
   1.181  	<select name="loram">
   1.182  		<option value="none">$(gettext "No")</option>
   1.183  		<option value="ram">$(gettext "In RAM only")</option>
   1.184 -		<option value="smallcdrom">$(gettext "Small CDROM or RAM")</option>
   1.185 -		<option value="cdrom">$(gettext "Large CDROM or RAM")</option>
   1.186 +		<option value="smallcdrom">$(gettext "Small CD-ROM or RAM")</option>
   1.187 +		<option value="cdrom">$(gettext "Large CD-ROM or RAM")</option>
   1.188  	</select>
   1.189 -	<input type="submit" value="Convert" />
   1.190 +	<input type="submit" value="$(gettext 'Convert')" />
   1.191  
   1.192  <input type="hidden" name="id" value="$id" />
   1.193  </form>
   1.194 @@ -226,14 +226,14 @@
   1.195  $([ "$tarball" ] && tarball_handler)
   1.196  
   1.197  <pre>
   1.198 -Uniq ID    : $id
   1.199 -Flavor     : $FLAVOR
   1.200 -Short desc : $SHORT_DESC
   1.201 +$(gettext 'Uniq ID    :') $id
   1.202 +$(gettext 'Flavor     :') $FLAVOR
   1.203 +$(gettext 'Short desc :') $SHORT_DESC
   1.204  </pre>
   1.205  <div class="next">
   1.206  	<form method="get" action="./">
   1.207  		<input type="hidden" name="id" value="$id" />
   1.208 -		<input type="submit" name="gen" value="$(gettext "Continue")">
   1.209 +		<input type="submit" name="gen" value="$(gettext 'Continue')">
   1.210  	</form>
   1.211  </div>
   1.212  EOT