Skip to content

Commit

Permalink
rear#3400 to avoid disks mounted without partition getting excluded
Browse files Browse the repository at this point in the history
Signed-off-by: gdha <[email protected]>
  • Loading branch information
gdha committed Feb 14, 2025
1 parent d765abf commit f82ddcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions usr/share/rear/layout/save/default/305_uniq_disktodo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Script 305_uniq_disktodo.sh
# make LAYOUT_TODO file uniq, but we do not change the order in any way
# See details in issue #3400
unique_unsorted $LAYOUT_TODO >${LAYOUT_TODO}.new
mv -f ${LAYOUT_TODO}.new $LAYOUT_TODO
7 changes: 6 additions & 1 deletion usr/share/rear/lib/layout-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,12 @@ get_partition_start() {

# Get the type of a layout component
get_component_type() {
grep -E "^[^ ]+ $1 " $LAYOUT_TODO | cut -d " " -f 3
local component="$1"
local component_types=()
component_types=( $( grep -E "^[^ ]+ $component " $LAYOUT_TODO | cut -d " " -f 3 | uniq ) )
test ${#component_types[@]} -lt 1 && return 1
test ${#component_types[@]} -gt 1 && BugError "Layout component '$component' has more than one type in $LAYOUT_TODO"
echo "${component_types[0]}"
}

# Get the disklabel (partition table) type of the disk $1 from the layout file
Expand Down

0 comments on commit f82ddcd

Please sign in to comment.