Skip to content

Commit

Permalink
In apply_layout_mappings it is no error when there are leftover repla…
Browse files Browse the repository at this point in the history
…cement strings in comments (issue rear#2183)
  • Loading branch information
jsmeix committed Jul 18, 2019
1 parent d412999 commit f74abb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ while read component_type disk_device old_disk_size disk_label junk ; do
disk_size_difference=$( mathlib_calculate "$new_disk_size - $old_disk_size" )
if test $disk_size_difference -gt 0 ; then
# The size of the new disk is bigger than the size of the old disk:
DebugPrint "New $disk_device is $disk_size_difference bigger than old disk"
DebugPrint "New $disk_device is $disk_size_difference bytes bigger than old disk"
increase_threshold_difference=$( mathlib_calculate "$old_disk_size / 100 * $AUTOINCREASE_DISK_SIZE_THRESHOLD_PERCENTAGE" )
if test $disk_size_difference -lt $increase_threshold_difference ; then
if is_true "$last_part_is_resizeable" ; then
Expand All @@ -422,7 +422,7 @@ while read component_type disk_device old_disk_size disk_label junk ; do
# The size of the new disk is smaller than the size of the old disk:
# Currently disk_size_difference is negative but we prefer to use its absolute value:
disk_size_difference=$( mathlib_calculate "0 - $disk_size_difference" )
DebugPrint "New $disk_device is $disk_size_difference smaller than old disk"
DebugPrint "New $disk_device is $disk_size_difference bytes smaller than old disk"
# There is no need to shrink the last partition when the original last partition still fits on the new smaller disk:
if test $last_part_end -le $new_disk_remainder_start ; then
if is_true "$last_part_is_resizeable" ; then
Expand Down
5 changes: 4 additions & 1 deletion usr/share/rear/lib/layout-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,10 @@ function apply_layout_mappings() {
while read original replacement junk ; do
# Skip lines that have wrong syntax:
test "$original" -a "$replacement" || continue
if grep -q "$replacement" "$file_to_migrate" ; then
# Only treat leftover temporary replacement words as an error
# if they are in a non-comment line (comments have '#' as first non-space character)
# cf. https://github.com/rear/rear/issues/2183
if grep -v '^[[:space:]]*#' "$file_to_migrate" | grep -q "$replacement" ; then
apply_layout_mappings_succeeded="no"
LogPrintError "Failed to apply layout mappings to $file_to_migrate for $original (probably no mapping for $original in $MAPPING_FILE)"
fi
Expand Down

0 comments on commit f74abb2

Please sign in to comment.