You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Modified `enough_free_space` to check both target and current directories
- Estimates the storage size with du
- Fixed showing the estimated size if there's enough space
Copy file name to clipboardExpand all lines: functions/backup_func.sh
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -52,14 +52,20 @@ function backup_func() {
52
52
done
53
53
54
54
# Ensure that there's enough space in the directory according to what is backed up
55
-
local space=$(enough_free_space "$archive_path")
56
-
if [[ -n"$space"&&"$space"-ne 0 ]];then
57
-
local bkp_size_mb=$(echo "scale=2; $space/1024"| bc)
58
-
echo -e "\033[31mThere isn't enough space in the selected directory for the backup. Estimated backup size: $bkp_size_mb MB\033[0m"
55
+
cecho "Estimating backup size, please wait..."
56
+
57
+
local estimated_size
58
+
enough_free_space "$archive_path" estimated_size
59
+
local fs_status=$?
60
+
local bkp_size_mb=$(echo "scale=2; $estimated_size/1024"| bc)
61
+
62
+
if [ $fs_status-ne 0 ];then
63
+
echo -e "\033[31mThere isn't enough space for the backup. Estimated backup size: ${bkp_size_mb} MB\033[0m"
64
+
echo -e "\033[31mFree up space on both the target and backup script locations (to handle temporary files). Double the space is needed if backing up to the drive the backup script is located on.\033[0m"
59
65
cecho "Exiting..."
60
66
exit 1
61
67
else
62
-
cecho "Enough space in the current directory. Estimated backup size: $bkp_size_mb MB"
68
+
cecho "Enough space in the current directory. Estimated backup size: ${bkp_size_mb} MB"
63
69
fi
64
70
65
71
# The companion app is needed only for contact backups.
cecho "Note: SMS messages and call logs cannot be restored by Open Android Backup at the moment. They are included in the backup archive for your own purposes."
212
218
cecho "You can find them by opening the backup archive using 7-Zip."
0 commit comments