added a script to restor sdcards from files
This commit is contained in:
parent
9a22456e47
commit
93b2dc85a6
2 changed files with 30 additions and 2 deletions
|
@ -14,8 +14,9 @@ echo "about to clone $device to $dest_file"
|
||||||
echo "ctrl-c or [enter]"
|
echo "ctrl-c or [enter]"
|
||||||
read
|
read
|
||||||
|
|
||||||
umount $device?
|
sudo umount $device?
|
||||||
umount $device
|
sudo umount $device
|
||||||
|
|
||||||
sudo pv -tpreb $device | dd bs=4M | pixz > $dest_file
|
sudo pv -tpreb $device | dd bs=4M | pixz > $dest_file
|
||||||
|
sudo sync
|
||||||
|
|
||||||
|
|
27
tools/restore_sdcard
Executable file
27
tools/restore_sdcard
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -z $1 ]] || [[ -z $2 ]]; then
|
||||||
|
echo "usage: $0 restore_file.xz device_to_restore_to"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
source_file=$1
|
||||||
|
if [[ ! -f $source_file ]]; then
|
||||||
|
echo "cannot open $source_file"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
device=$2
|
||||||
|
timestamp=`date +%Y%m%d`
|
||||||
|
|
||||||
|
echo "about to restore $source_file onto $device"
|
||||||
|
echo "ctrl-c or [enter]"
|
||||||
|
read
|
||||||
|
|
||||||
|
sudo umount $device?
|
||||||
|
sudo umount $device
|
||||||
|
|
||||||
|
pv -tpreb $source_file | pixz -d | sudo dd bs=4M of=$device
|
||||||
|
sudo sync
|
||||||
|
sudo eject $device
|
||||||
|
|
Loading…
Reference in a new issue