tazusb rev 26

Add clean function and typos
author Paul Issott <paul@slitaz.org>
date Tue May 20 22:03:45 2008 +0000 (2008-05-20)
parents 6c960dd30d6b
children aca7d6ba0b36
files tazusb
line diff
     1.1 --- a/tazusb	Sun May 18 22:53:10 2008 +0200
     1.2 +++ b/tazusb	Tue May 20 22:03:45 2008 +0000
     1.3 @@ -31,8 +31,9 @@
     1.4    format	Format and label device with ext3 filesystem 
     1.5                  (for LiveUSB or /home).
     1.6    gen-liveusb 	Generate a bootable LiveUSB using files from the LiveCD.
     1.7 -  gen-swap      Creat or recreat and active additionnal swap memory.
     1.8 -  gen-iso2usb   Generate a bootable LiveUSB using files from ISO file\n"
     1.9 +  gen-swap      Create or recreate and activate additional swap memory.
    1.10 +  gen-iso2usb   Generate a bootable LiveUSB using files from ISO file.
    1.11 +  clean         Remove old backup filesystems to free disk space.\n"
    1.12  }
    1.13  
    1.14  # Status function.
    1.15 @@ -290,7 +291,7 @@
    1.16  	echo ""
    1.17  	echo -en "\033[1mGen swap\033[0m
    1.18  ===============================================================================
    1.19 -Generate a swap file in /home/swap that will be activate on each boot to have
    1.20 +Generate a swap file in /home/swap that will be activated on each boot to have
    1.21  more memory available (Empty value to exit).
    1.22  
    1.23  Swap file in Mb : "
    1.24 @@ -312,6 +313,29 @@
    1.25  	echo ""
    1.26  }
    1.27  
    1.28 +# Clean out old backups to save disk space
    1.29 +clean_usb() 
    1.30 +{
    1.31 +	echo ""
    1.32 +	echo -en "\033[1mClean\033[0m
    1.33 +===============================================================================
    1.34 +Remove old rootfs.gz.unixtimestamp backup filesystems to free up disk space.\n\n"
    1.35 +	# locate and interactively remove old filesystems from /home directory
    1.36 +	for file in `find /home/boot/rootfs.gz.[0-9]*`
    1.37 +	do
    1.38 +		echo -n "Do you wish to remove: `basename $file` (Yes/no/exit) ? "
    1.39 +		read answer
    1.40 +		case $answer in
    1.41 +			e|E|"exit"|Exit)
    1.42 +				exit 0 ;;
    1.43 +			y|Y|yes|Yes)
    1.44 +				rm -f $file ;;
    1.45 +			*)
    1.46 +			echo -en "No filesystems selected, exiting...\n" ;;
    1.47 +		esac
    1.48 +	done
    1.49 +}
    1.50 +
    1.51  #
    1.52  # Tazusb sequence
    1.53  #
    1.54 @@ -473,7 +497,11 @@
    1.55  		copy_cdrom_files
    1.56  		install_boot
    1.57  		exit_or_reboot
    1.58 -		;;		
    1.59 +		;;	
    1.60 +	clean)
    1.61 +	    check_root
    1.62 +	    clean_usb
    1.63 +	    ;;	
    1.64  	usage|*)
    1.65  		# Display usage by default.
    1.66  		usage