From b2a04f23d6f004bae86ab6bb0ebedd56f0a48de3 Mon Sep 17 00:00:00 2001 From: Zheng Pan Date: Tue, 12 Mar 2024 18:21:05 -0700 Subject: [PATCH] Support conditional insmod Conditional insmod config file format condinsmod|system_property_name|module1|module2 if getprop system_property_name == true; load module1 else load module2 Bug: 325647677 Change-Id: I0f2dd92caaefd707a626b9f80923aeab495d31a2 --- insmod/insmod.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/insmod/insmod.sh b/insmod/insmod.sh index 03843f5..8cac37e 100755 --- a/insmod/insmod.sh +++ b/insmod/insmod.sh @@ -66,6 +66,17 @@ if [ -f $cfg_file ]; then "insmod") insmod $arg ;; "setprop") setprop $arg 1 ;; "enable") echo 1 > $arg ;; + "condinsmod") + prop=$(echo $arg | cut -d '|' -f 1) + module1=$(echo $arg | cut -d '|' -f 2) + module2=$(echo $arg | cut -d '|' -f 3) + value=$(getprop $prop) + if [[ ${value} == "true" ]]; then + insmod ${vendor_modules_dir}/${module1} + else + insmod ${vendor_modules_dir}/${module2} + fi + ;; "modprobe") case ${arg} in "system -b *" | "system -b")