Compare commits

..

2 Commits

Author SHA1 Message Date
70b0087b89 backup selector changed 2021-01-24 13:45:30 +03:00
3d8327112d fix "encrypted" question 2021-01-24 13:41:30 +03:00

View File

@ -26,13 +26,15 @@ rsync_dir_list=($(rsync --password-file=rsync_pass rsync://$source | awk '{print
##choose backup
echo "==>" ${#rsync_dir_list[@]} backups: ${rsync_dir_list[@]}
read -p "Input backup number:" backupNum
read -p "Input backup name:" backupName
until [ $backupNum -le ${#rsync_dir_list[@]} ]
do
read -p "Input backup number:" backupNum
done
let "backupNum -= 1"
echo "Selected: " $backupName
#until [ $backupNum -le ${#rsync_dir_list[@]} ]
#do
#read -p "Input backup name:" backupName
#done
#let "backupNum -= 1"
##set target drive
@ -42,8 +44,8 @@ do
read -p "Target drive is " targetDrive
targetDrive=/dev/$targetDrive
done
echo "Encrypted?"
while read -r -n 1 -s answer ; do
echo "Encrypted? (Y/n) "
while read -r -n 1 answer ; do
if [[ $answer = [YyNn] ]]; then
[[ $answer = [Yy] ]] && encryptedDevice=true && echo "WARNING You will be asked for password later" #read -p "Password: " encryptedPassword
[[ $answer = [Nn] ]] && encryptedDevice=false
@ -138,7 +140,8 @@ mount $targetDrive"2" /mnt/boot
##rsync
echo "==> Copying from NAS..."
rsync --archive --password-file=rsync_pass rsync://$source${rsync_dir_list[$backupNum]}/ /mnt/
#rsync --archive --password-file=rsync_pass rsync://$source${rsync_dir_list[$backupNum]}/ /mnt/
rsync --archive --password-file=rsync_pass rsync://$source$backupName/ /mnt/
retVal=$?
if [ $retVal -ne 0 ]; then
exit 1