From 987c96d5c3c8f33f27828ca74a12058c4f87413c Mon Sep 17 00:00:00 2001 From: Bela Lubkin Date: Sun, 16 Mar 2014 16:12:06 -0700 Subject: [PATCH] - Forgot the rest of previous commit (separate zeroing from making backup)! --- NookManager/menu/backup | 32 +++++++++++++------------------ NookManager/scripts/create_backup | 19 ------------------ 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/NookManager/menu/backup b/NookManager/menu/backup index 15d5c00..3bde1fe 100644 --- a/NookManager/menu/backup +++ b/NookManager/menu/backup @@ -3,42 +3,36 @@ MENU=/tmp/sdcache/menu title="Create Backup" header= -button1= +button1="<- Erase empty storage (makes backup faster)" +button2="Format remaining space on SD card ->" button3="<- Back" -button2= -button4= +button4="Create backup ->" footer= key=0 -if [ ! -b /dev/block/mmcblk1p2 ]; then - header="Backups will be stored on this SD card.\nTo proceed, you must format the unused\nspace on this card." - button2="Format remaining space on SD card ->" -else - header="It will take 15-45 minutes to create a backup." - button4="Create backup ->" -fi - until [ "$key" -eq "3" ]; do + if [ ! -b /dev/block/mmcblk1p2 ]; then + header="Backups will be stored on this SD card.\nTo proceed, you must format the unused\nspace on this card." + else + header="It will take 15-45 minutes to create a backup." + fi + $SCRIPT/menu -t "$title" -h "$header" -f "$footer" -1 "$button1" -2 "$button2" -3 "$button3" -4 "$button4" key=$? if [[ "$key" -eq "2" ]]; then $SCRIPT/menu -t "$title" -h "$header" -f "Formatting free space on SD card..." footer=`$SCRIPT/format_unused_sdcard` - header="It will take 15-45 minutes to create a backup." - button2="" - button4="Create backup ->" + + elif [[ "$key" -eq "1" ]]; then + $SCRIPT/menu -t "$title" -h "$header" -f "Erasing empty storage areas..." + footer=`$SCRIPT/shrink_data` elif [[ "$key" -eq "4" ]]; then $SCRIPT/menu -t "$title" -h "$header" -f "Creating backup image...\nBackup started `date +%H:%M:%S`" footer=`$SCRIPT/create_backup` - # If the backup succeeded, hide the create backup button - if [ "$?" -eq "0" ]; then - header="" - button4="" - fi fi done diff --git a/NookManager/scripts/create_backup b/NookManager/scripts/create_backup index 93ccfad..6e91b3e 100644 --- a/NookManager/scripts/create_backup +++ b/NookManager/scripts/create_backup @@ -7,26 +7,8 @@ umount /tmp/backups mkdir -p /tmp/backups mount -t vfat /dev/block/mmcblk1p2 /tmp/backups -$SCRIPT/mount_nook - echo Backup started `date +%H:%M:%S` -# Zero the free space on each of the Nook's partitions -dd if=/dev/zero of=/nook/factory/DELETEME bs=512k -rm /nook/factory/DELETEME - -dd if=/dev/zero of=/nook/system/DELETEME bs=512k -rm /nook/system/DELETEME - -dd if=/dev/zero of=/nook/userdata/DELETEME bs=512k -rm /nook/userdata/DELETEME - -dd if=/dev/zero of=/nook/cache/DELETEME bs=512k -rm /nook/cache/DELETEME - -dd if=/dev/zero of=/nook/data/DELETEME bs=512k -rm /nook/data/DELETEME - sync dd if=/dev/block/mmcblk0 bs=1000k | gzip -1 > /tmp/backups/backup.full.gz @@ -46,7 +28,6 @@ fi sync umount /tmp/backups -$SCRIPT/umount_nook echo "/dev/block/mmcblk1p2" > /sys/devices/platform/usb_mass_storage/lun1/file