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
This commit is contained in:
Zheng Pan 2024-03-12 18:21:05 -07:00
parent ce4e42d661
commit b2a04f23d6

View file

@ -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")