2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-31 09:20:23 +00:00

turn nanodroid_nlpbackend into an array for better code

This commit is contained in:
Christopher Roy Bratusek 2018-11-27 19:14:35 +01:00
parent 5593656ccc
commit 0744150577
3 changed files with 45 additions and 29 deletions

View File

@ -687,26 +687,27 @@ install_microg () {
fi
fi
case ${nanodroid_nlpbackend} in
0 ) NLPBACKEND=""
ui_print " << with microG [Nominatim]" ;;
1 ) NLPBACKEND="nlpBackendDejavu"
ui_print " << with microG [Déjà Vu, Nominatim]" ;;
2 ) NLPBACKEND="nlpBackendIchnaea"
ui_print " << with microG [Ichnaea, Nominatim]" ;;
3 ) NLPBACKEND="nlpBackendApple"
ui_print " << with microG [Apple, Nominatim]" ;;
4 ) NLPBACKEND="nlpBackendDejavu nlpBackendIchnaea"
ui_print " << with microG [Déjà Vu, Ichnaea, Nominatim]" ;;
5 ) NLPBACKEND="nlpBackendDejavu nlpBackendApple"
ui_print " << with microG [Déjà Vu, Apple, Nominatim]" ;;
6 ) NLPBACKEND="nlpBackendIchnaea nlpBackendApple"
ui_print " << with microG [Ichnaea, Apple, Nominatim]" ;;
7 ) NLPBACKEND="nlpBackendDejavu nlpBackendIchnaea nlpBackendApple"
ui_print " << with microG [Déjà Vu, Ichnaea, Apple, Nominatim]" ;;
esac
NLPBACKEND="nlpBackendNominatim"
NLPSTRING="Nominatim"
for app in ${NLPBACKEND} nlpBackendNominatim; do
if [ "${nanodroid_nlpbackend[0]}" -eq 1 ]; then
NLPBACKEND="${NLPBACKEND} nlpBackendDejavu"
NLPSTRING="${NLPSTRING}, Déjà Vu"
fi
if [ "${nanodroid_nlpbackend[1]}" -eq 1 ]; then
NLPBACKEND="${NLPBACKEND} nlpBackendIchnaea"
NLPSTRING="${NLPSTRING}, Ichnaea"
fi
if [ "${nanodroid_nlpbackend[2]}" -eq 1 ]; then
NLPBACKEND="${NLPBACKEND} nlpBackendApple"
NLPSTRING="${NLPSTRING}, Apple"
fi
ui_print " << with microg [${NLPSTRING}]"
for app in ${NLPBACKEND}; do
nanodroid_install_apk ${app}
done
@ -1375,7 +1376,23 @@ check_cfg_setup () {
[ -z "${nanodroid_gsync}" ] && set_prop nanodroid_gsync 0
[ -z "${nanodroid_forcesystem}" ] && set_prop nanodroid_forcesystem 0
[ -z "${nanodroid_swipe}" ] && set_prop nanodroid_swipe 0
[ -z "${nanodroid_nlpbackend}" ] && set_prop nanodroid_nlpbackend 1
[ -z "${nanodroid_nlpbackend}" ] && set_prop nanodroid_nlpbackend "(1 0 0)"
# in NanoDroid <= 20.2 nanodroid_nlpbackend is an integer
# starting with 20.3 it's an array, migrate the value
if [ "${#nanodroid_nlpbackend[0]}" -eq 1 ]; then
case "${nanodroid_nlpbackend}" in
0 ) tmp_prop="(0 0 0)"
1 ) tmp_prop="(1 0 0)"
2 ) tmp_prop="(0 1 0)"
3 ) tmp_prop="(1 1 0)"
esac
sed -e '/^nanodroid_nlpbackend/d' -i "${cfg_setup}"
set_prop nanodroid_nlpbackend "${tmp_prop}"
fi
[ -z "${nanodroid_bash}" ] && set_prop nanodroid_bash 1
[ -z "${nanodroid_nano}" ] && set_prop nanodroid_nano 1
[ -z "${nanodroid_utils}" ] && set_prop nanodroid_utils 1

View File

@ -10,7 +10,7 @@ nanodroid_init=1
nanodroid_gsync=0
nanodroid_swipe=0
nanodroid_forcesystem=0
nanodroid_nlpbackend=3
nanodroid_nlpbackend=(1 0 0)
nanodroid_nano=1
nanodroid_bash=1
nanodroid_utils=1

View File

@ -28,7 +28,7 @@ nanodroid_init=1
nanodroid_gsync=0
nanodroid_swipe=0
nanodroid_forcesystem=0
nanodroid_nlpbackend=3
nanodroid_nlpbackend=(1 0 0)
nanodroid_bash=1
nanodroid_nano=1
nanodroid_utils=1
@ -46,7 +46,7 @@ nanodroid_mapsv1=1
nanodroid_gsync=0
nanodroid_swipe=0
nanodroid_forcesystem=0
nanodroid_nlpbackend=1
nanodroid_nlpbackend=(1 0 0)
```
the **F-Droid** (nanodroid_fdroid is always 1) and **Bromite WebView** pckage supports the following options
@ -130,13 +130,12 @@ whether to provide Swipe libraries
whether to force system mode installation, regardless whether Magisk is installed
`nanodroid_nlpbackend=[0|1|2]`
`nanodroid_nlpbackend=([0|1] [0|1] [0|1])`
what location backend for microG to install
* 0 = no location backend
* 1 = Déjà Vu location backend
* 2 = Ichnaea (Mozilla) location backend
* 3 = Déjà Vu and Ichnaea location backends
what location backends for microG to install
* 1st element 0|1 = Déjà Vu location backend
* 2nd element 0|1 = Ichnaea (Mozilla) location backend
* 3rd element 0|1 = Apple location backend
`nanodroid_bash=[0|1]`