turn nanodroid_play into an array for better code

merge-requests/23/head
Christopher Roy Bratusek 6 years ago
parent 3e0db08a73
commit 6d5686ee88

@ -810,64 +810,50 @@ install_apps () {
} }
install_store () { install_store () {
NANODROID_APP_STORE="" STORE_APPNAME=""
NANODROID_REM_STORE=""
# install Yalp Store or Play Store whichever requested STORE_CHOICE=${nanodroid_play[0]}
case "${nanodroid_play}" in FAKE_STORE=${nanodroid_play[1]}
0 )
ui_print " << without App Store"
;;
[ "${FAKE_STORE}" -eq 1 ] && STORE_CONFLICT="Phonesky" || STORE_CONFLICT=""
# install Yalp Store or Play Store whichever requested
case "${STORE_CHOICE}" in
1 ) 1 )
ui_print " << with Play Store" ui_print " << with Play Store"
NANODROID_APP_STORE="Phonesky" STORE_APPNAME="Phonesky"
NANODROID_REM_STORE="FakeStore"
# force unselect Fake Store when user has choosen Play Store
STORE_CONFLICT="FakeStore"
FAKE_STORE=0
nanodroid_install_file etc/default-permissions/phonesky-permissions.xml nanodroid_install_file etc/default-permissions/phonesky-permissions.xml
;; ;;
2 ) 2 )
ui_print " << with Yalp Store" STORE_APPNAME="YalpStore"
NANODROID_APP_STORE="YalpStore"
NANODROID_REM_STORE=""
;; ;;
3 ) 3 )
ui_print " << with Aurora Store" STORE_APPNAME="AuroraStore"
NANODROID_APP_STORE="AuroraStore"
NANODROID_REM_STORE=""
;;
4 )
ui_print " << with Fake Store"
NANODROID_APP_STORE="FakeStore"
NANODROID_REM_STORE="Phonesky"
;;
5 )
ui_print " << with Yalp Store and Fake Store"
NANODROID_APP_STORE="YalpStore FakeStore"
NANODROID_REM_STORE="Phonesky"
;;
6 )
ui_print " << with Aurora Store and Fake Store"
NANODROID_APP_STORE="AuroraStore FakeStore"
NANODROID_REM_STORE="Phonesky"
;; ;;
esac esac
if [ ! -z "${NANODROID_APP_STORE}" ]; then if [ ! -z "${STORE_APPNAME}" ]; then
for app in ${NANODROID_APP_STORE}; do ui_print " << with ${STORE_APPNAME}"
nanodroid_install_apk ${app} nanodroid_install_apk "${STORE_APPNAME}"
done else
ui_print " << without App Store"
fi fi
if [ ! -z "${NANODROID_REM_STORE}" ]; then if [ "${FAKE_STORE}" -eq 1 ]; then
for app in ${NANODROID_REM_STORE}; do ui_print " << with Fake Store"
${NANODROID_BINDIR}/nanodroid-overlay --add ${app} nanodroid_install_apk FakeStore
done else ui_print " << without Fake Store"
fi
if [ ! -z "${STORE_CONFLICT}" ]; then
${NANODROID_BINDIR}/nanodroid-overlay --add ${STORE_CONFLICT}
if [ "${NANODROID_UPGRADE}" -eq 0 ]; then if [ "${NANODROID_UPGRADE}" -eq 0 ]; then
rm -rf /data/data/com.android.vending rm -rf /data/data/com.android.vending
@ -1363,7 +1349,23 @@ check_cfg_setup () {
[ -z "${nanodroid_microg}" ] && set_prop nanodroid_microg 1 [ -z "${nanodroid_microg}" ] && set_prop nanodroid_microg 1
[ -z "${nanodroid_gmscore}" ] && set_prop nanodroid_gmscore 0 [ -z "${nanodroid_gmscore}" ] && set_prop nanodroid_gmscore 0
[ -z "${nanodroid_apps}" ] && set_prop nanodroid_apps 1 [ -z "${nanodroid_apps}" ] && set_prop nanodroid_apps 1
[ -z "${nanodroid_play}" ] && set_prop nanodroid_play 1
[ -z "${nanodroid_play}" ] && set_prop nanodroid_play "(1 0)"
# in NanoDroid <= 20.2 nanodroid_play is an integer
# starting with 20.3 it's an array, migrate the value
if [ "${#nanodroid_play[@]}" -eq 1 ]; then
case "${nanodroid_play}" in
0 ) tmp_prop="(0 0)"
1 ) tmp_prop="(1 0)"
2 ) tmp_prop="(2 0)"
3 ) tmp_prop="(0 1)"
4 ) tmp_prop="(2 1)"
esac
sed -e '/^nanodroid_nlpbackend/d' -i "${cfg_setup}"
set_prop nanodroid_nlpbackend "${tmp_prop}"
fi
if [ "${MODID}" = "NanoDroid" ]; then if [ "${MODID}" = "NanoDroid" ]; then
[ -z "${nanodroid_overlay}" ] && set_prop nanodroid_overlay 1 [ -z "${nanodroid_overlay}" ] && set_prop nanodroid_overlay 1
@ -1381,7 +1383,7 @@ check_cfg_setup () {
# in NanoDroid <= 20.2 nanodroid_nlpbackend is an integer # in NanoDroid <= 20.2 nanodroid_nlpbackend is an integer
# starting with 20.3 it's an array, migrate the value # starting with 20.3 it's an array, migrate the value
if [ "${#nanodroid_nlpbackend[0]}" -eq 1 ]; then if [ "${#nanodroid_nlpbackend[@]}" -eq 1 ]; then
case "${nanodroid_nlpbackend}" in case "${nanodroid_nlpbackend}" in
0 ) tmp_prop="(0 0 0)" 0 ) tmp_prop="(0 0 0)"
1 ) tmp_prop="(1 0 0)" 1 ) tmp_prop="(1 0 0)"

@ -20,7 +20,7 @@ nanodroid_microg=1
nanodroid_gmscore=0 nanodroid_gmscore=0
nanodroid_fdroid=1 nanodroid_fdroid=1
nanodroid_apps=1 nanodroid_apps=1
nanodroid_play=1 nanodroid_play=(1 0)
nanodroid_overlay=1 nanodroid_overlay=1
nanodroid_zelda=1 nanodroid_zelda=1
nanodroid_mapsv1=1 nanodroid_mapsv1=1
@ -40,7 +40,7 @@ the **microG** package supports the following options (nanodroid_microg is alway
``` ```
nanodroid_gmscore=0 nanodroid_gmscore=0
nanodroid_play=1 nanodroid_play=(1 0)
nanodroid_overlay=0 nanodroid_overlay=0
nanodroid_mapsv1=1 nanodroid_mapsv1=1
nanodroid_gsync=0 nanodroid_gsync=0
@ -93,14 +93,17 @@ whether to override an already existing app.
`0` means that a ROM app is preferred against a NanoDroid app, where `1` means the NanoDroid app is prefered. This applies to included applications [> Details](doc/Applications.md) `0` means that a ROM app is preferred against a NanoDroid app, where `1` means the NanoDroid app is prefered. This applies to included applications [> Details](doc/Applications.md)
`nanodroid_play=[0|1|2|3|4]` `nanodroid_play=([0|1|2|3] [0|1])`
what app store to use: what app store to use:
* `0` will not provide any app store * 1st item
* `1` will provide **Play Store** * 0 = No App Store
* `2` will provide **Yalp Store** * 1 = Play Store
* `3` will provide **Fake Store** * 2 = Yalp Store
* `4` will provide **Yalp Store** and **Fake Store** * 3 = Aurora Store
* 2nd item
* 0 = without Fake Store
* 1 = with Fake Store
`nanodroid_overlay=[0|1]` `nanodroid_overlay=[0|1]`

@ -101,25 +101,25 @@ setup_add 14 nanodroid_override
if grep -q "selected.1=1" "${store_prop}"; then if grep -q "selected.1=1" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [None]" ui_print " <>> setting property: nanodroid_play [None]"
echo "nanodroid_play=0" >> "${nanodroid_setup}" echo "nanodroid_play=(0 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=2" "${store_prop}"; then elif grep -q "selected.1=2" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Play Store]" ui_print " <>> setting property: nanodroid_play [Play Store]"
echo "nanodroid_play=1" >> "${nanodroid_setup}" echo "nanodroid_play=(1 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=3" "${store_prop}"; then elif grep -q "selected.1=3" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Yalp Store]" ui_print " <>> setting property: nanodroid_play [Yalp Store]"
echo "nanodroid_play=2" >> "${nanodroid_setup}" echo "nanodroid_play=(2 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=4" "${store_prop}"; then elif grep -q "selected.1=4" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Aurora Store]" ui_print " <>> setting property: nanodroid_play [Aurora Store]"
echo "nanodroid_play=3" >> "${nanodroid_setup}" echo "nanodroid_play=(3 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=5" "${store_prop}"; then elif grep -q "selected.1=5" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Fake Store]" ui_print " <>> setting property: nanodroid_play [Fake Store]"
echo "nanodroid_play=4" >> "${nanodroid_setup}" echo "nanodroid_play=(0 1)" >> "${nanodroid_setup}"
elif grep -q "selected.1=6" "${store_prop}"; then elif grep -q "selected.1=6" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Yalp + Fake Store]" ui_print " <>> setting property: nanodroid_play [Yalp + Fake Store]"
echo "nanodroid_play=5" >> "${nanodroid_setup}" echo "nanodroid_play=(2 1)" >> "${nanodroid_setup}"
elif grep -q "selected.1=7" "${store_prop}"; then elif grep -q "selected.1=7" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Aurora + Fake Store]" ui_print " <>> setting property: nanodroid_play [Aurora + Fake Store]"
echo "nanodroid_play=6" >> "${nanodroid_setup}" echo "nanodroid_play=(3 1)" >> "${nanodroid_setup}"
fi fi
if grep -q "item.1.1=1" "${nlp_prop}"; then if grep -q "item.1.1=1" "${nlp_prop}"; then

Loading…
Cancel
Save