slitaz-tools rev 404

mountbox: fill selection
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 09 22:11:30 2009 +0100 (2009-11-09)
parents 9111553d3e51
children b158266db011
files lib/libmountbox
line diff
     1.1 --- a/lib/libmountbox	Sat Nov 07 14:06:48 2009 +0000
     1.2 +++ b/lib/libmountbox	Mon Nov 09 22:11:30 2009 +0100
     1.3 @@ -409,6 +409,9 @@
     1.4  		[ "$4" == "true" ] && bs="1K"
     1.5  		[ "$5" == "true" ] && bs="1M"
     1.6  		[ "$6" == "true" ] && bs="1024M"
     1.7 +		[ "$8" == "true" ] && dev="/dev/zero count=$size"
     1.8 +		[ "$9" == "true" ] && dev="/dev/urandom count=$size"
     1.9 +		[ "$10" == "true" ] && dev="/dev/zero seek=$size count=0"
    1.10  		if [ "$7" != "true" -a -e "$file" ]; then
    1.11  			export FILE_EXIST="
    1.12  <window title=\"File exist\" icon-name=\"media-flash\">
    1.13 @@ -429,7 +432,7 @@
    1.14  			gtkdialog --center --program=FILE_EXIST
    1.15  			exit
    1.16  		fi
    1.17 -		dd if=/dev/zero of=$file bs=$bs count=$size
    1.18 +		dd if=$dev of=$file bs=$bs
    1.19  		;;
    1.20  	new-file)
    1.21  		export CREATE_FILE="
    1.22 @@ -470,6 +473,21 @@
    1.23  		</radiobutton>
    1.24  	</hbox>
    1.25  	<hbox>
    1.26 +		<text use-markup=\"true\">
    1.27 +			<label>\"<b>Fill</b>\"</label>
    1.28 +		</text>
    1.29 +		<radiobutton>
    1.30 +			<label>random</label>
    1.31 +			<variable>RANDOM</variable>
    1.32 +		</radiobutton>
    1.33 +		<radiobutton>
    1.34 +			<label>zero</label>
    1.35 +			<variable>ZERO</variable>
    1.36 +		</radiobutton>
    1.37 +		<radiobutton>
    1.38 +			<label>sparse</label>
    1.39 +			<variable>SPARSE</variable>
    1.40 +		</radiobutton>
    1.41  		<checkbox>
    1.42  			<label>Override</label>
    1.43  			<variable>OVERRIDE</variable>
    1.44 @@ -478,7 +496,7 @@
    1.45  		<button>
    1.46  			<label>Create</label>
    1.47  			<input file icon=\"filenew\"></input>
    1.48 -			<action>/usr/lib/slitaz/libmountbox create-file \"\$FILE\" \"\$NEW_SIZE\" \$KB \$MB \$GB \$OVERRIDE</action>
    1.49 +			<action>/usr/lib/slitaz/libmountbox create-file \"\$FILE\" \"\$NEW_SIZE\" \$KB \$MB \$GB \$OVERRIDE \$ZERO \$RANDOM \$SPARSE</action>
    1.50  			<action type=\"closewindow\">CREATE_FILE</action>
    1.51  		</button>
    1.52  		<button>