Skip to content

Commit

Permalink
- Forgot the rest of previous commit (separate zeroing from making ba…
Browse files Browse the repository at this point in the history
…ckup)!
  • Loading branch information
filbo committed Mar 16, 2014
1 parent db6c50e commit 987c96d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
32 changes: 13 additions & 19 deletions NookManager/menu/backup
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 0 additions & 19 deletions NookManager/scripts/create_backup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,7 +28,6 @@ fi

sync
umount /tmp/backups
$SCRIPT/umount_nook

echo "/dev/block/mmcblk1p2" > /sys/devices/platform/usb_mass_storage/lun1/file

Expand Down

1 comment on commit 987c96d

@doozan
Copy link

@doozan doozan commented on 987c96d Mar 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this patch will always show the "format sdcard" and "create backup" options, regardless of the state of the sdcard. For simplicity, if the sd card is un-formatted it only show the "format sdcard" option, and if the sdcard is formatted it should show only the "create backup" and "zero remaining space" options.

I don't mind making the "zero remaining space" optional, but I'd like to see a comparison of the backup size of a "new" nook that has never been zeroed vs the resulting backup after it has been zeroed.

Please sign in to comment.