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
Copy file name to clipboardExpand all lines: functions/backup_func.sh
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,23 @@ function backup_func() {
51
51
esac
52
52
done
53
53
54
+
# Ensure that there's enough space in the directory according to what is backed up
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"
65
+
cecho "Exiting..."
66
+
exit 1
67
+
else
68
+
cecho "Enough space in the current directory. Estimated backup size: ${bkp_size_mb} MB"
69
+
fi
70
+
54
71
# The companion app is needed only for contact backups.
55
72
mkdir -p ./backup-tmp/Contacts # Always created for backwards compatibility
local apks_size=$(adb shell 'for p in $(pm list packages -3 -f | sed -E "s/package://; s/=.*//"); do stat -c%s "$p" 2>/dev/null; done'| awk '{s+=$1} END {print int(s/1024)}')
0 commit comments