linux-image-manager/scripts/image/backup.sh

31 lines
663 B
Bash
Raw Normal View History

2020-05-02 11:46:39 +02:00
#!/bin/bash
2020-05-03 20:58:23 +02:00
info "Backupscript for memory devices started"
echo
info "Actual mounted devices:"
echo
ls -lasi /dev/ | grep -E "sd|mm"
2020-05-02 11:46:39 +02:00
echo
while [ \! -b "$ifi" ]
do
2020-05-03 20:58:23 +02:00
info "Please select the correct device."
question "/dev/:"
2020-05-02 11:46:39 +02:00
read device
2020-05-03 20:58:23 +02:00
ifi="/dev/$device"
done
2020-05-02 11:46:39 +02:00
while [ "$path" == "" ]
do
2020-05-05 11:50:20 +02:00
echo "Bitte Backupimagepfad+Namen zu $PWD eingeben:"
read -r path
2020-05-02 11:46:39 +02:00
if [ "${path:0:1}" == "/" ]
then
2020-05-05 11:50:20 +02:00
ofi="$path.img"
2020-05-02 11:46:39 +02:00
else
2020-05-05 11:50:20 +02:00
ofi="$PWD/$path.img"
2020-05-02 11:46:39 +02:00
fi
done
2020-05-03 20:58:23 +02:00
info "Input file: $ifi"
info "Output file: $ofi"
question "Please confirm by pushing \"Enter\". To cancel use \"Ctrl + Alt + C\""
2020-05-05 11:50:20 +02:00
read -r bestaetigung
dd if="$ifi" of="$ofi" bs=1M status=progress