Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions usr/share/rear/layout/prepare/default/320_apply_mappings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ for file_to_migrate in "$LAYOUT_FILE" "$original_disk_space_usage_file" "$rescue
if apply_layout_mappings "$file_to_migrate" ; then
DebugPrint "Applied disk layout mappings to $file_to_migrate"
else
LogPrintError "Failed to apply disk layout mappings to $file_to_migrate"
applied_mappings_to_all_files="no"
if [ "$file_to_migrate" = "$original_disk_space_usage_file" ] ; then
LogPrint "WARNING: Failed to apply disk layout mappings to $file_to_migrate (likely due to unmapped excluded disks)."
else
LogPrintError "Failed to apply disk layout mappings to $file_to_migrate"
applied_mappings_to_all_files="no"
fi
fi
done
is_true $applied_mappings_to_all_files || Error "Failed to apply disk layout mappings"
Expand Down
17 changes: 17 additions & 0 deletions usr/share/rear/layout/save/GNU/Linux/510_current_disk_usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,20 @@ else
df -Pl -BM -x encfs -x tmpfs -x devtmpfs >$original_disk_space_usage_file
fi

# Automatically comment out lines in original_disk_space_usage_file that match AUTOEXCLUDE_PATH
if test "$AUTOEXCLUDE_PATH" ; then
for exclude in "${AUTOEXCLUDE_PATH[@]}" ; do
while read _ _ _ _ _ mountpoint ; do
# Check if mountpoint is a subdirectory of the exclude path
# Logic matching layout/save/default/320_autoexclude.sh:
if test "${mountpoint#${exclude%/}/}" != "$mountpoint" ; then
DebugPrint "Automatically excluding $mountpoint from $original_disk_space_usage_file (belongs to $exclude in AUTOEXCLUDE_PATH)"
local mp_pattern
# Escape the mountpoint for use in the subsequent sed command
mp_pattern=$( echo "$mountpoint" | sed 's/[][\/$*.^,]/\\&/g' )
# Comment out the line
sed -i "\, $mp_pattern$,s/^/#/" "$original_disk_space_usage_file"
fi
done < <( grep -v -E "^Filesystem|^#" "$original_disk_space_usage_file" )
done
fi