File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,26 @@ function backup_func() {
141141 # -mx=9: ultra compression
142142 # -bb3: verbose logging
143143 # The undefined variable (archive_password) is set by the user if they're using unattended mode
144+ if [ -z " $archive_password " ]; then
145+ while true ; do
146+ cecho " Enter a password to encrypt the backup archive (input will be hidden):"
147+ IFS= read -s archive_password
148+ echo
149+ cecho " Re-enter the password to confirm:"
150+ IFS= read -s archive_password_confirm
151+ echo
152+ if [ " $archive_password " = " $archive_password_confirm " ]; then
153+ unset archive_password_confirm
154+ break
155+ else
156+ cecho " Passwords do not match. Please try again."
157+ fi
158+ done
159+ fi
144160 declare backup_archive=" $archive_path /open-android-backup-$( date +%m-%d-%Y-%H-%M-%S) .7z"
145- retry 5 7z a -p" $archive_password " -mhe=on -mx=$compression_level -bb3 " $backup_archive " backup-tmp/*
161+ retry 5 7z a -p" $archive_password " -mhe=on -mx=$compression_level -bb3 " $backup_archive " backup-tmp/* < <( echo " $archive_password " )
162+ # Immediately clear sensitive password data
163+ unset archive_password
146164 fi
147165
148166 # We're not using 7-Zip's -sdel option (delete files after compression) to honor the user's choice to securely delete temporary files after a backup
You can’t perform that action at this time.
0 commit comments