#!/bin/sh

# Note: provisioning will be done with ubuntu_provision plugin (ofono-ubports)
# or apndb_provision (other variants).
disabled_plugins="stktest,sap,udev,dun,smart,hfp,hfp_bluez5,provision"

# choose between ofono-binder-plugin or ofono-ril-plugin
# by default for now, we default to ril
if [ "$(device-info get OfonoPlugin)" = "binder" ]; then
    # disable ril plugin so binder one is used
    disabled_plugins="$disabled_plugins,ril"
else
    # disable binder so ril binder is used
    disabled_plugins="$disabled_plugins,binder"
fi

# Use LineageOS's apndb instead of /system/etc/apns-conf.xml hard-coded in
# ubuntu_provision.
if [ -z "$OFONO_SYSTEM_APNDB_PATH" ]; then
    export OFONO_SYSTEM_APNDB_PATH="/usr/share/lineageos-apndb/apns-conf.xml"
fi

exec /usr/sbin/ofonod -P $disabled_plugins --nodetach "$@"
