Skip to content

Commit 42cdb10

Browse files
5ec1cffbackslashxx
authored andcommitted
ksud: fix odm not magic-mounted
1 parent 55b6cb5 commit 42cdb10

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

userspace/ksud/src/installer.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,13 @@ is_legacy_script() {
303303

304304
handle_partition() {
305305
PARTITION="$1"
306+
REQUIRE_SYMLINK="$2"
306307
if [ ! -e "$MODPATH/system/$PARTITION" ]; then
307308
# no partition found
308309
return;
309310
fi
310311

311-
if [ -L "/system/$PARTITION" ] && [ "$(readlink -f "/system/$PARTITION")" = "/$PARTITION" ]; then
312+
if [ "$REQUIRE_SYMLINK" = "false" ] || [ -L "/system/$PARTITION" ] && [ "$(readlink -f "/system/$PARTITION")" = "/$PARTITION" ]; then
312313
ui_print "- Handle partition /$PARTITION"
313314
ln -sf "$MODPATH/system/$PARTITION" "$MODPATH/$PARTITION"
314315
fi
@@ -388,10 +389,10 @@ install_module() {
388389
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
389390
fi
390391

391-
handle_partition vendor
392-
handle_partition system_ext
393-
handle_partition product
394-
handle_partition odm
392+
handle_partition vendor true
393+
handle_partition system_ext true
394+
handle_partition product true
395+
handle_partition odm false
395396

396397
# Handle replace folders
397398
for TARGET in $REPLACE; do

userspace/ksud/src/magic_mount.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,15 @@ fn collect_module_files() -> Result<Option<Node>> {
148148
}
149149

150150
if has_file {
151-
for partition in ["vendor", "system_ext", "product", "odm"] {
151+
for (partition, require_symlink) in [
152+
("vendor", true),
153+
("system_ext", true),
154+
("product", true),
155+
("odm", false),
156+
] {
152157
let path_of_root = Path::new("/").join(partition);
153158
let path_of_system = Path::new("/system").join(partition);
154-
if path_of_root.is_dir() && path_of_system.is_symlink() {
159+
if path_of_root.is_dir() && (!require_symlink || path_of_system.is_symlink()) {
155160
let name = partition.to_string();
156161
if let Some(node) = system.children.remove(&name) {
157162
root.children.insert(name, node);

0 commit comments

Comments
 (0)