[bglug] 13 macchine windows da gestire in modo centralizzato

k|b|s kbs@bglug.it
Ven 20 Gen 2006 15:29:41 CET


abaddon al scrîf:
> Ciao a tutti,
> io ho sta situazione: 13 pc da formattare una volta al mese circa.... perchè 
> gli utenti fanno solo danni... e perdere tempo non ne ho voglia per sti 
> beoti... ho provato ad usare ghost, le immagini le lasciavo in una partizione 
> nascosta.. ma i classici smanettoni ovviamente in alcuni casi oltre a rompere 
> me le cancellavano anche...
> A sto punto volevo chiedervi se  esiste un sistema centralizzato che mi 
> permetta di mantenere pulito windows? e ad ogni riavvio si connette al server 
> verifica la situazione e se trova qualche porcata risistema tutto
> Possibilmente su linux ovviamente :)
g4l (ghost for linux).
Si appoggia a ddrescue. Su stixx rescue c'è.
In ogni caso eccolo qui. (occhio al line feed... nel caso c'è l'url)
Altrimenti partimage/partimaged.

!!cat scripts/g4l  -->

--8<-- CUT HERE --8<--
#!/bin/sh
#


: ${DIALOG=dialog}
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_ESC=255}

# global vars
author="Frank Stephen"
version="v0.14"
year="2004"
website="http://freshmeat.net/projects/g4l"

# path to images on ftp server
ftppath=img

# window title
backtitle="g4l $version, $author $year"


# parse info about devices to tempfiles
netdevices=`cat /proc/net/dev |grep eth |sed -e 's/://g' |awk '{print $1}'`
partitions=`cat /proc/partitions |grep .d |awk '{print $4}'`

# write systeminfo file
echo "Drive/Partition sizes: " >> /tmp/sysinfo
cat /proc/partitions |grep .d | awk '{print $4,$3}' |sort >>/tmp/sysinfo
echo >> /tmp/sysinfo
echo "Drive models: " >> /tmp/sysinfo
for h in $partitions
do
length=`echo $h |wc -c`
if [ $length -lt 5 ]; then
echo $h >> /tmp/sysinfo
cat /proc/ide/$h/model >> /tmp/sysinfo 2>/dev/null
fi
done

# write menulists
partlist=""
netlist=""

for i in $partitions
do partlist="$partlist `echo $i detected...OK off`"
done

for j in $netdevices
do netlist="$netlist `echo $j detected...OK off`"
done


function createTemp ()
{
	export tempfile${1}="/tmp/test${1}$$"
}

#
# create tempfiles for menu structure
#

#main menu
createTemp main

#raw mode menu
createTemp rawmenu


# net menu
createTemp netmenu

# net config
createTemp device

# net device
createTemp ip

# net ftp
createTemp ftp

# net filename
createTemp netname

# net zip
createTemp netzip

# netbackup menu
createTemp netback

# netrestore menu
createTemp netrest




# local menu
createTemp localmenu

# local drive
createTemp localdrive

# local filename
createTemp localname


# local split
createTemp localsplit

# local zip
createTemp localzip

# local backup menu
createTemp localback

# local restore menu
createTemp localrest



# clone menu
createTemp clonemenu

# clone source
createTemp clonesource

# clone target
createTemp clonetarget


# file mode menu
createTemp filemenu

# file mode eth device
createTemp fileip

# file mode ip address
createTemp filedevice


# file mode partition
createTemp filepart


# util menu
createTemp utilmenu

# util hdparm
createTemp hdparm

# util zero
createTemp utilzero

# util dd_rescue
createTemp ddres

# util dd_rescue source
createTemp ddressource

# util dd_rescue target
createTemp ddrestarget


$DIALOG --backtitle "$backtitle" \
	--title "INFORMATION" --clear \
		--yesno "g4l - Gh*st for Linux \n \
		$author $year \n\n \
		g4l comes with ABSOLUTELY NO WARRANTY ! \n \
		This is free Software, and you are welcome \n \
		to redistribute it freely. Read the online Help\n \
		for more info on this delicate topic. \n\n \
		USE AT OWN RISK! \n\n \
		Also, g4l has NOTHING to do with the famous\n \
		\"Norton GHOST\" (c) and (tm) by Symantec!\n \
		visit www.symantec.com to get their product.\n\n \
		Accept these conditions? YES to proceed, NO to quit. " 20 60

case $? in
$DIALOG_OK)

	while [ "$retvalmain" != "1" ]
	do

		retvalrawmenu=0
		retvalfilemenu=0
		retvalnetmenu=0
		retvalclonemenu=0
		retvallocalmenu=0
		retvalutilmenu=0

		$DIALOG --backtitle "$backtitle" \
				--title "MAIN MENU" \
				--menu "Choose your desired mode:"  0 0 0 \
					"RAW Mode"  "ANY filesystem, every bit, local+ftp" \
					"File Mode"  "Some filesystems only, only files, local+special server" \
					"Utilities"  "System info and tools" \
					"Show Help"  "Show IMPORTANT help" 2> $tempfilemain
		retvalmain=$?

		choicemain=`cat $tempfilemain`

		case $retvalmain in
		$DIALOG_OK)
			case $choicemain in
			"RAW Mode")
				while [ "$retvalrawmenu" != "1" ]
				do
				$DIALOG --backtitle "$backtitle" \
						--title "RAW MODE" \
						--menu "Choose one of the following options: \n\n" 0 0 0\
							"Network use"  "Backup/Restore to/from network" \
							"Local use"  "Backup/Restore to/from local drive" \
							"Click'n'Clone"  "Directly clone a drive" \
							"Show Help"  "Show IMPORTANT helpfile" 2> $tempfilerawmenu

				retvalrawmenu=$?

				choicerawmenu=`cat $tempfilerawmenu`

				case $retvalrawmenu in
				$DIALOG_OK)
					case $choicerawmenu in
					"Network use")
						retvalnetmenu=0

						while [ "$retvalnetmenu" != "1" ]
						do
							$DIALOG --clear --backtitle "$backtitle" \
									--title "NETWORK USE" \
									--menu "Choose one of the following options: \n\n" 0 0 0 \
										"Pick device"  "Select ethernet device" \
										"Config device"  "Set IP address" \
										"Config FTP"  "Set IP for FTP server" \
										"Config filename"  "Set filename on FTP" \
										"Toggle compression"  "Select compression types" \
										"Backup"  "Backup drive/partition to FTP server" \
										"Restore"  "Restore drive/partition from FTP server" 2> $tempfilenetmenu

							retvalnetmenu=$?

							choicenetmenu=`cat $tempfilenetmenu`

							case $retvalnetmenu in
							$DIALOG_OK)

								case $choicenetmenu in
								"Pick device")

									$DIALOG --backtitle "$backtitle" \
											--title "PICK DEVICE" \
											--radiolist "Choose network device \n\
														Select from:" 0 0 0 \
														$netlist 2> $tempfiledevice
									retvaldevice=$?

									choicedevice=`cat $tempfiledevice`

									case $retvaldevice in
									$DIALOG_OK)

										device=$choicedevice
									;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
									;;
									esac
									;;

							"Config device")
									$DIALOG --backtitle "$backtitle" \
											--title "Set Network" --clear \
											--inputbox "Set IP Address to match your subnet. \
												\nExample: 192.168.0.5 \
												\n\nEnter IP Address:" 0 0 2> $tempfileip

									retvalip=$?
									case $retvalip in
									$DIALOG_OK)

										ipaddress=`cat $tempfileip`
										/sbin/ifconfig $device $ipaddress up
									;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
										if test -s $tempfileip ; then
											ipaddress=`cat $tempfileip`
											/sbin/ifconfig $device $ipaddress up
										fi
										;;
									esac
									;;


							"Config FTP")
								$DIALOG --backtitle "$backtitle" \
										--title "CONFIG FTP" --clear \
										--inputbox "Enter IP Address of FTP Server. \
												\nFTP server musst allow anonymous write access! \
												\nExample: 192.168.0.1 \
												\n\nFTP IP:" 0 0 2> $tempfileftp

								retvalftp=$?
								case $retvalftp in
								$DIALOG_OK)

									server=`cat $tempfileftp`
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
									if test -s $tempfileftp ; then
										server=`cat $tempfileftp`
									fi
								;;
								esac
								;;


							"Config filename")
								$DIALOG --backtitle "$backtitle" \
										--title "CONFIG FILENAME" --clear \
										--inputbox "Enter filename of the stored image. \
											\nExample: hda_workstation2.img \
											\n\nFilename:" 0 0 2> $tempfilenetname

								retvalnetname=$?
								case $retvalnetname in
								$DIALOG_OK)

									netimagename=`cat $tempfilenetname`
								;;
								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
									if test -s $tempfilenetname ; then
										netimagename=`cat $tempfilenetname`
									fi
								;;
								esac
								;;

							"Toggle compression")
								$DIALOG --backtitle "$backtitle" \
										--title "TOGGLE COMPRESSION" \
										--radiolist "Choose wether to use compression or not. \
											\nBe careful, compression requires much CPU power!" 0 0 0 \
											"None" "No compression." ON \
											"GZip" "GZip compression." off \
											"BZip2" "BZip2 compression." off 2> $tempfilenetzip

								retvalnetzip=$?

								choicenetzip=`cat $tempfilenetzip`
								case $retvalnetzip in
								$DIALOG_OK)

									netzip=`cat $tempfilenetzip`
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
									if test -s $tempfilenetzip ; then
										netzip=`cat $tempfilenetzip`
									fi
								;;

								esac
								;;

							"Backup")
								if [ "$ipaddress" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No Networtk IP Address for eth0 set! \n
													->Back to Main Menu." 0 0
									continue
								fi



								if [ "$server" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
										--title "ERROR" --clear \
										--msgbox "No FTP IP Address set! \n
												->Back to Main Menu." 0 0
									continue
								fi

								if [ "$netimagename" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
										--title "WARNING" --clear \
										--msgbox "No filename for image set, using default \n
												Filename: image.img.gz" 0 0
									netimagename=image.img.gz
								fi



								if [ "$netzip" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
										--title "WARNING" --clear \
										--msgbox "Compression not defined, using default \n
												Compression: None" 0 0
									netzip=None
								fi


								$DIALOG --backtitle "$backtitle" \
										--title "BACKUP" \
										--radiolist "Choose Drive or Partition to backup\n\
												Select from:" 0 0 0 \
												$partlist 2> $tempfilenetback

								retvalnetback=$?

								choicenetback=`cat $tempfilenetback`

								case $retvalnetback in
								$DIALOG_OK)

									disk=/dev/$choicenetback

									$DIALOG --backtitle "$backtitle" \
											--title "ABOUT TO BACKUP" --clear \
											--yesno "Collected information: \
													\nLocal IP Address: $ipaddress \
													\nFTP IP Address: $server \
													\nTarget imagename: $netimagename \
													\nFTP path: $ftppath \
													\nCompression: $netzip \
													\nSource Drive: $disk \
													\n\nAre you sure?" 0 0
									case $? in
									$DIALOG_OK)

										readsize=`cat /proc/partitions |grep -w $choicenetback |awk '{print $3}'`
										pcnt=0

										if [ "$netzip" = "None" ] ; then
											(dd if=$disk 2>/dev/null | jetcat-mod -p $readsize 2>/tmp/netback.out |ncftpput -c -d /tmp/out $server "/$ftppath/$netimagename") &

											(
											while test "$pcnt" != "100"
											do
												pcnt=`tail -n1 /tmp/netback.out`
												echo "XXX"
												echo $pcnt
												echo "\n"
												echo "g4l is backing up your harddrive.\n"
												echo "Every single bit of the drive is copied, so:\n\n"
												echo "Please stand by, this might take some time!\n"
												echo "XXX"
												sleep 3
											done
											) | $DIALOG --backtitle "$backtitle" \
														--title "Working..." \
														--gauge "One moment..." 18 60
											rm /tmp/netback.out
											touch /tmp/netback.out

										fi


										if [ "$netzip" = "GZip" ] ; then

											(dd if=$disk 2>/dev/null | jetcat-mod -p $readsize 2>/tmp/netback.out |gzip -c - | ncftpput -c -d /tmp/out $server "/$ftppath/$netimagename") &


											(
											while test "$pcnt" != "100"
											do
												pcnt=`tail -n1 /tmp/netback.out`
												echo "XXX"
												echo $pcnt
												echo "\n"
												echo "g4l is backing up your harddrive.\n"
												echo "Every single bit of the drive is copied, so:\n\n"
												echo "Please stand by, this might take some time!\n"
												echo "XXX"
												sleep 3
											done
											) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
													--gauge "One moment..." 18 60
											rm /tmp/netback.out
											touch /tmp/netback.out




										fi

										if [ "$netzip" = "BZip2" ] ; then

											(dd if=$disk 2>/dev/null | jetcat-mod -p $readsize 2>/tmp/netback.out |bzip2 | ncftpput -c -d /tmp/out $server "/$ftppath/$netimagename") &


											(
											while test "$pcnt" != "100"
											do
												pcnt=`tail -n1 /tmp/netback.out`
												echo "XXX"
												echo $pcnt
												echo "\n"
												echo "g4l is backing up your harddrive.\n"
												echo "Every single bit of the drive is copied, so:\n\n"
												echo "Please stand by, this might take some time!\n"
												echo "XXX"
												sleep 3
											done
											) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
													--gauge "One moment..." 18 60
											rm /tmp/netback.out
											touch /tmp/netback.out




										fi



									;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
									;;
									esac
									;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
								;;



							"Restore")
								if [ "$ipaddress" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No Networtk IP Address for eth0 set! \n
													->Back to Main Menu." 0 0
									continue
								fi

								if [ "$server" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No FTP IP Address set! \n
													->Back to Main Menu." 0 0
									continue
								fi

								if [ "$netimagename" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "No filename for image set, using default \n
													Filename: image.img.gz" 0 0
									netimagename=image.img.gz
								fi

								if [ "$netzip" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "Compression not defined, using default \n
													Compression: None" 0 0
									netzip=None
								fi

								$DIALOG --backtitle "$backtitle" \
										--title "RESTORE" \
										--radiolist "Choose drive or partition to restore the image to \
													\n\nSelect from:" 0 0 0 \
													$partlist 2> $tempfilenetrest

								retvalnetrest=$?

								choicenetrest=`cat $tempfilenetrest`
								case $retvalnetrest in
								$DIALOG_OK)

										rest=/dev/$choicenetrest

										$DIALOG --backtitle "$backtitle" \
												--title "About to restore disk" --clear \
												--yesno "Collected information: \
														\nLocal IP Address: $ipaddress \
														\nFTP IP Address: $server \
														\nSource imagename: $netimagename \
														\nFTP path: $ftppath \
														\nCompression: $netzip \
														\nTarget disk: $rest \n\n \
														\n\nAre you sure?" 0 0
										case $? in
										$DIALOG_OK)

											writesize=`cat /proc/partitions |grep -w $choicenetrest |awk '{print $3}'`
											pcnt=0


											if [ "$netzip" = "None" ] ; then
												(ncftpget -c -V -d /tmp/out $server "/$ftppath/$netimagename" | jetcat-mod -p $writesize 2>/tmp/netrest.out | dd of=$rest 2>/dev/null) &


												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/netrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/netrest.out
												touch /tmp/netrest.out

											fi

											if [ "$netzip" = "GZip" ] ; then

												(ncftpget -c -V -d /tmp/out $server "/$ftppath/$netimagename" | gunzip -c -| jetcat-mod -p $writesize 2>/tmp/netrest.out |dd of=$rest 2>/dev/null) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/netrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/netrest.out
												touch /tmp/netrest.out

											fi

											if [ "$netzip" = "BZip2" ] ; then

												(ncftpget -c -V -d /tmp/out $server "/$ftppath/$netimagename" | bzcat | jetcat-mod -p $writesize 2>/tmp/netrest.out |dd of=$rest 2>/dev/null) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/netrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/netrest.out
												touch /tmp/netrest.out
											fi
											rm /tmp/out
											touch /tmp/out
										;;

										$DIALOG_CANCEL)
										;;

										$DIALOG_ESC)
										;;

										esac
										;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
									;;

									esac
									;;
								esac
								;;
							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
							;;
							esac


						done
					;;

				"Local use")

					retvallocalmenu=0
					
					while [ "$retvallocalmenu" != "1" ]
					do
						$DIALOG --clear --backtitle "$backtitle" \
								--title "LOCAL USE" \
								--menu "Choose one of the following options: \n\n" 0 0 0 \
										"Pick drive"  "Select target/source drive" \
										"Config filename"  "Set filename" \
										"Toggle split"  "Activate file splitting" \
										"Toggle compression"  "Select compression types" \
										"Backup"  "Backup drive/partition to local drive" \
										"Restore"  "Restore drive/partition from local drive" 2> $tempfilelocalmenu

						retvallocalmenu=$?

						choicelocalmenu=`cat $tempfilelocalmenu`

						case $retvallocalmenu in
						$DIALOG_OK)

							case $choicelocalmenu in

							"Pick drive")

								$DIALOG --backtitle "$backtitle" \
										--title "PICK DRIVE" \
										--radiolist "Choose drive to write to/read from.\
												\nSupported FS are:\n\
												ext2 - Linux\n\
												ext3 - Linux\n\
												reiserfs - Linux\n\
												fat32 - Windows95/98/NT/2k/XP\n\
												ntfs - Windows NT/2k/XP\
												\n\nSelect partition (example: /dev/hda1):" 0 0 0 \
												$partlist 2> $tempfilelocaldrive


								retvallocaldrive=$?

								choicelocaldrive=`cat $tempfilelocaldrive`
								case $retvallocaldrive in
								$DIALOG_OK)

									localdrive=$choicelocaldrive
									mount /dev/$localdrive /mnt/local >/tmp/mount 2>&1
									retvalmount=$?
									if [ $retvalmount != 0 ] ; then
										$DIALOG --backtitle "$backtitle" \
												--title "ERROR" \
												--textbox /tmp/mount 0 0
										localdrive=""
										umount /mnt/local
									fi

								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
								;;

							"Config filename")
								$DIALOG --backtitle "$backtitle" \
										--title "CONFIG FILENAME" --clear \
										--inputbox "Enter filename of the stored image. \
												\nExample: hda_workstation2.img \
												\n\nFilename:" 0 0 2> $tempfilelocalname

								retvallocalname=$?
								case $retvallocalname in
								$DIALOG_OK)

									localimagename=`cat $tempfilelocalname`
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)

									if test -s $tempfilelocalname ; then
										localimagename=`cat $tempfilelocalname`
									fi
								;;
								esac
								;;

							"Toggle split")
								$DIALOG --backtitle "$backtitle" \
										--title "TOGGLE SPLIT" \
										--radiolist "Choose if the imagefile should be split. \
													\nIf the FS limits filesize to 2GB, enable splitting!" 0 0 0 \
													"Off" "Splitting off." ON \
													"On" "Splitting on." off  2> $tempfilelocalsplit

								retvallocalsplit=$?

								choicelocalsplit=`cat $tempfilelocalsplit`
								case $retvallocalsplit in
								$DIALOG_OK)

									localsplit=`cat $tempfilelocalsplit`
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)

									if test -s $tempfilelocalsplit ; then
										localsplit=`cat $tempfilelocalsplit`
									fi
								;;
								esac
								;;


							"Toggle compression")

								$DIALOG --backtitle "$backtitle" \
										--title "TOGGLE COMPRESSION" \
										--radiolist "Choose wether to use compression or not. \
													\nBe careful, compression requires much CPU power!" 0 0 0 \
													"None" "No compression." ON \
													"GZip" "GZip compression." off \
													"BZip2" "BZip2 compression." off 2> $tempfilelocalzip

								retvallocalzip=$?

								choicelocalzip=`cat $tempfilelocalzip`
								case $retvallocalzip in
								$DIALOG_OK)

									localzip=`cat $tempfilelocalzip`
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
									if test -s $tempfilelocalzip ; then
										localzip=`cat $tempfilelocalzip`
									fi
								;;

								esac
								;;


							"Backup")

								if [ "$localdrive" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No target drive set! \n
													->Back to Main Menu." 0 0
									continue
								fi


								if [ "$localimagename" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "No filename for image set, using default \n
													Filename: image.img.gz" 0 0
									localimagename=image.img.gz
								fi

								if [ "$localsplit" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "Splitting not defined, using default \n
													Splitting: Off" 0 0
									localsplit=Off
								fi


								if [ "$localzip" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "Compression not defined, using default \n
													Compression: None" 0 0
									localzip=None
								fi

								$DIALOG --backtitle "$backtitle" \
										--title "BACKUP" \
										--radiolist "Choose Drive or Partition to backup\n\
													Select from:" 0 0 0 \
													$partlist 2> $tempfilelocalback

								retvallocalback=$?

								choicelocalback=`cat $tempfilelocalback`

								case $retvallocalback in
								$DIALOG_OK)

									localback=/dev/$choicelocalback

									$DIALOG --backtitle "$backtitle" \
											--title "ABOUT TO BACKUP" --clear \
											--yesno "Collected information: \
													\nTarget drive in /mnt/local: $localdrive \
													\nFilename for image: $localimagename \
													\nSplitting: $localsplit \
													\nCompression: $localzip \
													\nSource drive: $localback \
													\n\nAre you sure?" 0 0

									case $? in
									$DIALOG_OK)

										localreadsize=`cat /proc/partitions |grep -w $choicelocalback |awk '{print $3}' `
										pcnt=0

										if [ "$localzip" = "None" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out | dd of=/mnt/local/$localimagename 2>/dev/null &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out
											fi

											if [ "$localsplit" = "On" ] ; then

												(dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out |split -b 2000m - /mnt/local/$localimagename. ) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out

											fi
										fi


										if [ "$localzip" = "GZip" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												(dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out |gzip -c - >/mnt/local/$localimagename) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out

											fi


											if [ "$localsplit" = "On" ] ; then

												(dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out | gzip -c - | split -b 2000m - /mnt/local/$localimagename. ) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out

											fi

										fi


										if [ "$localzip" = "BZip2" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												(dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out | bzip2 >/mnt/local/$localimagename) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out
											fi

											if [ "$localsplit" = "On" ] ; then

												(dd if=$localback 2>/dev/null |jetcat-mod -p $localreadsize 2>/tmp/localback.out | bzip2 | split -b 2000m - /mnt/local/$localimagename. ) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localback.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is backing up your harddrive locally.\n"
													echo "\n"
													echo "Every single bit of the drive is copied, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localback.out
												touch /tmp/localback.out
											fi
										fi

										umount /mnt/local
										rm /tmp/out
										touch /tmp/out
									;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
									;;

									esac
									;;
								esac
								;;


							"Restore")

								if [ "$localdrive" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No target drive set! \n
													->Back to Main Menu." 0 0
									continue
								fi


								if [ "$localimagename" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "No filename for image set, using default \n
													Filename: image.img.gz" 0 0
									localimagename=image.img.gz
								fi

								if [ "$localsplit" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "Splitting not defined, using default \n
													Splitting: Off" 0 0
									localsplit=Off
								fi


								if [ "$localzip" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "WARNING" --clear \
											--msgbox "Compression not defined, using default \n
													Compression: None" 0 0
									localzip=None
								fi


								$DIALOG --backtitle "$backtitle" \
										--title "RESTORE" \
										--radiolist "Choose Drive or Partition to restore\n\
													Select from:" 0 0 0 \
													$partlist 2> $tempfilelocalrest


								retvallocalrest=$?

								choicelocalrest=`cat $tempfilelocalrest`
								case $retvallocalrest in
								$DIALOG_OK)

									localrest=/dev/$choicelocalrest

									$DIALOG --backtitle "$backtitle" \
											--title "ABOUT TO RESTORE" --clear \
											--yesno "Collected information: \
													\nTarget drive in /mnt/local: $localdrive \
													\nFilename for image: $localimagename \
													\nSplitting: $localsplit \
													\nCompression: $localzip \
													\nTarget drive: $localrest \
													\n\nAre you sure?" 0 0

									case $? in
									$DIALOG_OK)

										localwritesize=`cat /proc/partitions |grep -w $choicelocalrest |awk '{print $3}' `
										pcnt=0

										if [ "$localzip" = "None" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												(dd if=/mnt/local/$localimagename 2>/dev/null |jetcat-mod -p $localwritesize 2>/tmp/localrest.out |dd of=$localrest 2>/dev/null) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out
											fi

											if [ "$localsplit" = "On" ] ; then

												(cat /mnt/local/$localimagename.* |jetcat-mod -p $localwritesize 2>/tmp/localrest.out |dd of=$localrest 2>/dev/null) &
												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out
											fi
										fi


										if [ "$localzip" = "GZip" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												(dd if=/mnt/local/$localimagename 2>/dev/null |gunzip -c - |jetcat-mod -p $localwritesize 2>/tmp/localrest.out |dd of=$localrest 2>/dev/null) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out

											fi


											if [ "$localsplit" = "On" ] ; then

												(cat /mnt/local/$localimagename.* |gunzip -c - |jetcat-mod -p $localwritesize 2>/tmp/localrest.out |dd of=$localrest 2>/dev/null) &
												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out
											fi

										fi

										if [ "$localzip" = "BZip2" ] ; then

											if [ "$localsplit" = "Off" ] ; then

												(dd if=/mnt/local/$localimagename 2>/dev/null |bzcat |jetcat-mod -p $localwritesize 2>/tmp/localrest.out |dd of=$localrest 2>/dev/null) &
												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out
											fi

											if [ "$localsplit" = "On" ] ; then

												(bzcat /mnt/local/$localimagename.* |jetcat-mod -p $localwritesize 2>/tmp/localrest.out | dd of=$localrest 2>/dev/null) &

												(
												while test "$pcnt" != "100"
												do
													pcnt=`tail -n1 /tmp/localrest.out`
													echo "XXX"
													echo $pcnt
													echo "\n"
													echo "g4l is restoring your harddrive locally.\n"
													echo "\n"
													echo "The progress bar will be inaccurate if you restore\n"
													echo "backups from small drives to large drives.\n\n"
													echo "Every single bit of the drive is written, so:\n\n"
													echo "Please stand by, this might take some time!\n"
													echo "XXX"
													sleep 3
												done
												) | $DIALOG --backtitle "$backtitle" \
															--title "Working..." \
															--gauge "One moment..." 18 60
												rm /tmp/localrest.out
												touch /tmp/localrest.out
											fi
										fi

										umount /mnt/local
										rm /tmp/out
										touch /tmp/out
									;;

									$DIALOG_CANCEL)
									;;

									$DIALOG_ESC)
									;;

									esac
									;;
								esac
								;;

							esac
							;;

						$DIALOG_CANCEL)
						;;

						$DIALOG_ESC)
						;;

						esac
					done
					;;

				"Click'n'Clone")

					while [ "$retvalclonemenu" != "1" ]
					do
						$DIALOG --clear --backtitle "$backtitle" \
								--title "CLICK'n'CLONE" \
								--menu "Choose one of the following options: \n\n" 0 0 0 \
										"Select source"  "Select source drive" \
										"Select target"  "Select target drive" \
										"Click'n'Clone"  "Clone the drive now!" 2> $tempfileclonemenu

						retvalclonemenu=$?

						choiceclonemenu=`cat $tempfileclonemenu`

						case $retvalclonemenu in
						$DIALOG_OK)

							case $choiceclonemenu in
							"Select source")

								$DIALOG --backtitle "$backtitle" \
										--title "SELECT SOURCE" \
										--radiolist "Choose source drive to clone.\n\
													Select from:" 0 0 0 \
													$partlist 2> $tempfileclonesource

								retvalclonesource=$?

								choiceclonesource=`cat $tempfileclonesource`
								case $retvalclonesource in
								$DIALOG_OK)

									clonesource=/dev/$choiceclonesource
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
								;;

							"Select target")
								$DIALOG --backtitle "$backtitle" \
										--title "SELECT TARGET" \
										--radiolist "Choose target drive to clone to.\n\
													Attention: Select a drive with at least\n\
													the same capacity. Higher capacity is OK.\n\
													Select from:" 0 0 0 \
													$partlist 2> $tempfileclonetarget


								retvalclonetarget=$?

								choiceclonetarget=`cat $tempfileclonetarget`
								case $retvalclonetarget in
								$DIALOG_OK)

									clonetarget=/dev/$choiceclonetarget
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
								;;


							"Click'n'Clone")
								if [ "$clonesource" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No source drive for cloning set! \n
													->Back to Main Menu." 0 0
									continue
								fi

								if [ "$clonetarget" = "" ] ; then

									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" --clear \
											--msgbox "No target drive for cloning set! \n
													->Back to Main Menu." 0 0
									continue
								fi

								$DIALOG --backtitle "$backtitle" \
										--title "ABOUT TO CLONE" --clear \
										--yesno "Collected information: \
												\nSource drive: $clonesource \
												\nTarget drive: $clonetarget \
												\n\nAre you sure?" 0 0
								case $? in
								$DIALOG_OK)

									clonesize=`cat /proc/partitions |grep -w $choiceclonesource |awk '{print $3}' `
									pcnt=0

									dd if=$clonesource 2>/dev/null |jetcat-mod -p $clonesize 2>/tmp/clone.out |dd of=$clonetarget 2>/dev/null &

									(
									while test "$pcnt" != "100"
									do
										pcnt=`tail -n1 /tmp/clone.out`
										echo "XXX"
										echo $pcnt
										echo "\n"
										echo "g4l is cloning your harddrive.\n"
										echo "\n"
										echo "Every single bit of the drive is written, so:\n\n"
										echo "Please stand by, this might take some time!\n"
										echo "XXX"
										sleep 3
									done
									) | $DIALOG --backtitle "$backtitle" \
												--title "Working..." \
												--gauge "One moment..." 18 60
									rm /tmp/clone.out
									touch /tmp/clone.out
									rm /tmp/out
									touch /tmp/out
								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;
								esac
								;;
							esac
							;;

						$DIALOG_CANCEL)
						;;

						$DIALOG_ESC)
						;;

						esac
					done
					;;

					$DIALOG_CANCEL)
					;;

					$DIALOG_ESC)
					;;

					esac
					;;
				$DIALOG_ESC)
				;;

				esac

			done
			;;
			"File Mode")
				while [ "$retvalfilemenu" != "1" ]
				do
					$DIALOG --clear --backtitle "$backtitle" \
							--title "FILE MODE" \
							--menu "Choose one of the following options: \n\n" 0 0 0 \
								"Pick device"  "Select ethernet device (client/server mode only)" \
								"Config device"  "Set IP address (client/server mode only)" \
								"Select partition"  "Select partition to mount (server/local mode only)" \
								"Launch client"  "Launch 'partimage' in client/local mode" \
								"Launch server"  "Launch 'partimage' in server mode" 2> $tempfilefilemenu

					retvalfilemenu=$?

					choicefilemenu=`cat $tempfilefilemenu`

					case $retvalfilemenu in
					$DIALOG_OK)

						case $choicefilemenu in
						"Pick device")

							$DIALOG --backtitle "$backtitle" \
									--title "PICK DEVICE" \
									--radiolist "Choose network device \n\
												Select from:" 0 0 0 \
												$netlist 2> $tempfilefiledevice
							retvalfiledevice=$?

							choicefiledevice=`cat $tempfilefiledevice`

							case $retvalfiledevice in
							$DIALOG_OK)

								filedevice=$choicefiledevice
							;;

							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
							;;
							esac
							;;

						"Config device")
							$DIALOG --backtitle "$backtitle" \
									--title "CONFIG DEVICE" --clear \
									--inputbox "Set IP Address to match your subnet. \
										\nExample: 192.168.0.5 \
										\n\nEnter IP Address:" 0 0 2> $tempfilefileip

							retvalfileip=$?
							case $retvalfileip in
							$DIALOG_OK)

								fileipaddress=`cat $tempfilefileip`
								/sbin/ifconfig $filedevice $fileipaddress up
							;;

							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
								if test -s $tempfilefileip ; then
									fileipaddress=`cat $tempfilefileip`
									/sbin/ifconfig $filedevice $fileipaddress up
								fi
								;;
							esac
							;;


						"Select partition")
							$DIALOG --backtitle "$backtitle" \
									--title "SELECT PARTITION" \
									--radiolist "Choose drive to mount.\
												\nThe selected drive will be mounted to /mnt/local
												\nand partimage may write to this directory.\n
												\nSupported FS are:\n\
												ext2 - Linux\n\
												ext3 - Linux\n\
												reiserfs - Linux\n\
												fat32 - Windows95/98/NT/2k/XP\n\
												ntfs - Windows NT/2k/XP\n\
												JFS and XFS\
												\n\nSelect partition(!) (example: /dev/hda1):" 0 0 0 \
												$partlist 2> $tempfilefilepart

							retvalfilepart=$?

							choicefilepart=`cat $tempfilefilepart`
							case $retvalfilepart in
							$DIALOG_OK)

								filepart=$choicefilepart
								mount /dev/$filepart /mnt/local >/tmp/filemount 2>&1
								retvalfilemount=$?

								if [ $retvalfilemount != 0 ] ; then
									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" \
											--textbox /tmp/filemount 0 0
									filepart=""
									umount /mnt/local
								else
									$DIALOG --backtitle "$backtitle" \
											--title "STATUS" \
											--msgbox "Partition mounted in /mnt/local. \
													\nYou can now launch partimage to create or restore an image.\
													\nAs target file enter a filename in /mnt/local/, \
													\nfor example: /mnt/local/backup_hda1.img.gz \
													\n\n \
													\nYou can also launch partimage in network mode." 10 50

								fi
							;;

							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
							;;

							esac
							;;
						"Launch client")
							clear
							partimage -f3
							umount /mnt/local
							;;

						"Launch server")
							$DIALOG --backtitle "$backtitle" \
									--title "INFO" \
									--msgbox "'partimage' server will be launched now. \
											\nAfter it started, remove the CD and use it \
											\nto launch the 'partimage' client on another machine." 10 50

							clear
							partimaged
							umount /mnt/local

						esac
						;;
					esac

				done
				;;

			"Utilities")

				while [ "$retvalutilmenu" != "1" ]
				do
					$DIALOG --clear --backtitle "$backtitle" \
							--title "UTILITIES" \
							--menu "Choose one of the following options: \n\n" 0 0 0 \
								"System info"  "Show drives, partitions and models" \
								"hdparm"  "Set 32-bit I/O and UDMA66 (NEW hardware only!)" \
								"Zero-Tool"  "Zero-out free space on a partition" \
								"dd_rescue"  "Rescue defective drive and clone to new one" \
								"Parted"  "Launch 'parted' partition manager (EXPERT USE!)" 2> $tempfileutilmenu

					retvalutilmenu=$?

					choiceutilmenu=`cat $tempfileutilmenu`

					case $retvalutilmenu in
					$DIALOG_OK)

						case $choiceutilmenu in
						"System info")

							$DIALOG --backtitle "$backtitle" \
									--title "SYSTEM INFO" \
									--textbox /tmp/sysinfo 20 35
						;;


						"hdparm")
							$DIALOG --backtitle "$backtitle" \
								--title "WARNING" --clear \
									--yesno "This option tries to enable 32-bit I/O mode \
									\nand UDMA/66 mode on your IDE Controller and drive. \
									\n \
									\nThe system might hang and require a reboot! \
									\nUse this option only on quite new computers! \
									\n \
									\nContinue at own risk?" 0 0

							case $? in
							$DIALOG_OK)

								$DIALOG --backtitle "$backtitle" \
										--title "HDPARM" \
										--radiolist "Choose drive(!) to enable.\
													\n\nExample: /dev/hda" 0 0 0 $partlist 2> $tempfilehdparm

								retvalhdparm=$?

								choicehdparm=`cat $tempfilehdparm`
								case $retvalhdparm in
								$DIALOG_OK)

									hdparmdrive=/dev/$choicehdparm
									hdparm -c3 -X66 $hdparmdrive >/tmp/hdparmout

									$DIALOG --backtitle "$backtitle" \
											--title "HDPARM OUTPUT" \
											--textbox /tmp/hdparmout 0 0


								;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
								;;

							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
							;;
							esac
							;;

						"Zero-Tool")

							$DIALOG --backtitle "$backtitle" \
									--title "ZERO-TOOL" \
									--radiolist "Choose drive to zero-out.\
												\nSupported FS are:\n\
												ext2 - Linux\n\
												ext3 - Linux\n\
												reiserfs - Linux\n\
												fat32 - Windows95/98/NT/2k/XP\n\
												ntfs - Windows NT/2k/XP\
												\n\nSelect partition (example: /dev/hda1):" 0 0 0 \
									$partlist 2> $tempfileutilzero

							retvalutilzero=$?

							choiceutilzero=`cat $tempfileutilzero`
							case $retvalutilzero in
							$DIALOG_OK)

								zerodrive=$choiceutilzero
								mount /dev/$zerodrive /mnt/local >/tmp/zeromount 2>&1
								retvalzeromount=$?

								if [ $retvalzeromount != 0 ] ; then
									$DIALOG --backtitle "$backtitle" \
											--title "ERROR" \
											--textbox /tmp/zeromount 0 0
									zerodrive=""
									umount /mnt/local

								else

									freesize=`df |grep -w $zerodrive |awk '{print $4}'`
									pcnt=0

									(dd if=/dev/zero 2>/dev/null |jetcat-mod -p $freesize 2>/tmp/zero.out |split -b 2000m - /mnt/local/zerofile. 2>/dev/null ) &

									(
									while test "$pcnt" != "100"
									do
										pcnt=`tail -n1 /tmp/zero.out`
										echo "XXX"
										echo $pcnt
										echo "\n"
										echo "Zero-Tool is creating 2GB large files containing\n"
										echo "only zeros. If the harddrive is full, the files will\n"
										echo "be deleted and the drive will be unmount.\n"
										echo "This allows a very good compression of the unused\n"
										echo "space between your files.\n\n"
										echo "Please stand by, this might take some time!\n"
										echo "XXX"
										sleep 3
									done
									) | $DIALOG --backtitle "$backtitle" \
												--title "Working..." \
												--gauge "One moment..." 18 60
								fi

								rm /mnt/local/zerofile.*
								umount /mnt/local
								rm /tmp/zero.out
								touch /tmp/zero.out

							;;

							$DIALOG_CANCEL)
							;;

							$DIALOG_ESC)
							;;

							esac
							;;

						"dd_rescue")
							while [ "$retvalddres" != "1" ]
							do
								$DIALOG --clear --backtitle "$backtitle" \
										--title "DD_RECSCUE" \
										--menu "Choose one of the following options: \n\n" 0 0 0 \
												"Select source"  "Select (defective) source drive" \
												"Select target"  "Select (new/clean) target drive" \
												"Rescue"  "Rescue the drive now!" 2> $tempfileddres

								retvalddres=$?

								choiceddres=`cat $tempfileddres`

								case $retvalddres in
								$DIALOG_OK)

									case $choiceddres in
									"Select source")

										$DIALOG --backtitle "$backtitle" \
												--title "SELECT SOURCE" \
												--radiolist "Choose (defective) source drive to clone.\n\
															Select from:" 0 0 0 \
															$partlist 2> $tempfileddressource

										retvalddressource=$?

										choiceddressource=`cat $tempfileddressource`
										case $retvalddressource in
										$DIALOG_OK)

											ddressource=/dev/$choiceddressource
										;;

										$DIALOG_CANCEL)
										;;

										$DIALOG_ESC)
										;;

										esac
										;;

									"Select target")
										$DIALOG --backtitle "$backtitle" \
												--title "SELECT TARGET" \
												--radiolist "Choose (new/clean) target drive to clone to.\n\
															Attention: Select a drive with at least\n\
															the same capacity. Higher capacity is OK.\n\
															Select from:" 0 0 0 \
															$partlist 2> $tempfileddrestarget


										retvalddrestarget=$?

										choiceddrestarget=`cat $tempfileddrestarget`
										case $retvalddrestarget in
										$DIALOG_OK)

											ddrestarget=/dev/$choiceddrestarget
										;;

										$DIALOG_CANCEL)
										;;

										$DIALOG_ESC)
										;;

										esac
										;;


									"Rescue")
										if [ "$ddressource" = "" ] ; then

											$DIALOG --backtitle "$backtitle" \
													--title "ERROR" --clear \
													--msgbox "No source drive to rescue set! \n
															->Back to Main Menu." 0 0
											continue
										fi

										if [ "$ddrestarget" = "" ] ; then

											$DIALOG --backtitle "$backtitle" \
													--title "ERROR" --clear \
													--msgbox "No target drive for rescue set! \n
															->Back to Main Menu." 0 0
											continue
										fi

										$DIALOG --backtitle "$backtitle" \
												--title "ABOUT TO RESCUE" --clear \
												--yesno "Collected information: \
														\nDefective source drive: $ddressource \
														\nNew/Clean target drive: $ddrestarget \
														\n\
														\nIt might take VERY long to rescue the drive, \
														\nbut as long as you do NOT reboot, you can press \
														\nCTRL-C at any time and dd_rhelp will continue \
														\nfrom the same position it stopped if you re-enter \
														\nthis menu. If dd_rhelp is almost done and is only \
														\ntrying to read the defective sectors, it is OK to CTRL-C. \
														\n\
														\n\nAre you sure?" 0 0
										case $? in
										$DIALOG_OK)
											clear
											dd_rhelp $ddressource $ddrestarget
										;;

										$DIALOG_CANCEL)
										;;

										$DIALOG_ESC)
										;;
										esac
										;;
									esac
									;;

								$DIALOG_CANCEL)
								;;

								$DIALOG_ESC)
								;;

								esac
							done
						;;

						"Parted")

							clear
							parted
						;;

						esac
						;;


					$DIALOG_CANCEL)
					;;

					$DIALOG_ESC)
					;;

					esac
				done
				;;


			"Show Help")
				$DIALOG --clear --backtitle "$backtitle" \
						--title "HELP" \
						--textbox ./help 20 70
			;;

			esac
			;;

			$DIALOG_CANCEL)
				echo "Thanks for using g4l. visit $website"
				rm /tmp/*
				touch /tmp/out
				touch /tmp/zeroout
			;;

			$DIALOG_ESC)
				echo "ESC pressed."
			;;


		esac

	done
	;;
$DIALOG_CANCEL)
	exit 0
;;

$DIALOG_ESC)
	exit 0
;;

esac
--8<-- CUT HERE --8<--

-- 
No message found in this outgoing virus.
k|b|s > mailto `echo ti.gulgb@sbk|'rev'`


Maggiori informazioni sulla lista bglug