Skip to content

Commit 970e95a

Browse files
Refactor handle_partitions function and update calls
Refactor handle_partitions function to improve readability and logic. Update calls to handle_partitions for different partitions.
1 parent 2267f99 commit 970e95a

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

module/metainstall.sh

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,23 @@ mark_replace() {
1313
setfattr -n trusted.overlay.opaque -v y "$replace_target"
1414
}
1515

16+
install_module
17+
1618
handle_partitions() {
17-
PARTITION="$1"
18-
REQUIRE_SYMLINK="$2"
19-
if [ ! -e "$MODPATH/system/$PARTITION" ]; then
20-
# no partition found
21-
return;
22-
fi
23-
24-
if [ "$REQUIRE_SYMLINK" = "false" ] || [ -L "/system/$PARTITION" ] && [ "$(readlink -f "/system/$PARTITION")" = "/$PARTITION" ]; then
25-
ui_print "- Handle partition /$PARTITION"
26-
ln -sf "./system/$PARTITION" "$MODPATH/$PARTITION"
27-
fi
19+
partition="$1"
20+
21+
if [ ! -d "$MODPATH/system/$partition" ]; then
22+
return
23+
fi
24+
25+
if [ -L "/system/$partition" ] && [ -d "/$partition" ]; then
26+
ui_print "- Handle partition /$partition"
27+
ln -sf "./system/$partition" "$MODPATH/$partition"
28+
fi
2829
}
2930

30-
install_module
31-
32-
handle_partitions vendor true
33-
handle_partitions system_ext true
34-
handle_partitions product true
35-
handle_partitions odm false
31+
handle_partitions vendor
32+
handle_partitions system_ext
33+
handle_partitions product
34+
handle_partitions odm
3635

0 commit comments

Comments
 (0)