micro5k / microg-unofficial-installer

microG unofficial installer - it installs microG on Android
https://forum.xda-developers.com/showthread.php?t=3432360
GNU General Public License v3.0
162 stars 20 forks source link

Sideloading results in indefititely long fallback "waiting input" #59

Closed amo13 closed 1 year ago

amo13 commented 1 year ago

First things first, thank you a lot for creating and maintaining this microG installer. I just started integrating it into my Rom installation assistant because the latest builds of NanoDroid seem to be outdated and the maintenance a little scarce.

My application needs to sideload everything so that the user does not need to intervene. After sideloading the current version of your microG installer (on osprey), I see the message on the phone screen:

------------------------
INFO: Select the VOLUME + key to enable live sertup.
-------------------------
Waiting input for 2 seconds...

WARNING: timeout returned cmd NOT found (127)
Fallbacking to manual input parsing, waiting input...

At this point, the installation hangs indefinitely. At least it has stayed like that for almost an hour now. Is there a way to tell the installation script that interactivity is not desired?

I have seen in your code that sideload should be detected but there is no output on the screen telling that is has been detected.

ale5000-git commented 1 year ago

Hi, currently the "fallback to manual input parsing" doesn't have a timeout, it will be fixed in a new version. The sideload message is displayed later in the process, but it is only done to change the path of the debug log.

To disable the wait completely you can set LIVE_SETUP_TIMEOUT to 0. In the repository the settings are in these files (it depends if it is the OSS version or the full version): https://github.com/micro5k/microg-unofficial-installer/blob/main/zip-content/settings-full.conf https://github.com/micro5k/microg-unofficial-installer/blob/main/zip-content/settings-oss.conf

amo13 commented 1 year ago

Thank you for your answer. Do you think there is a way to set the configuration dynamically? Like with an environment variable or some TWRP variable? Otherwise, would I need to "build" the flashable zip with modified settings by myself? How would I create such a build or release as flashable zip?

ale5000-git commented 1 year ago

1) The only way that I know to set the configuration dynamically is to run from an adb shell:

2) If it were executed from a normal shell it can be configured, but with sideload I don't think environment variables will be kept.

3) I don't know about TWRP variables, do you have any link for this?

4) To build:

Alternatively you can use gradle as explained here: https://github.com/micro5k/microg-unofficial-installer/blob/main/docs/INSTRUCTIONS.rst

amo13 commented 1 year ago

Amazing! Thank you a lot for the instructions and detailed ideas! Looking forward to the next release including a timeout for the manual input. Any chance you can publish the full version as an additional asset in the github releases? Programmatically scraping the xda forum for the link to the latest "full" release is sort of a pain.

ale5000-git commented 1 year ago

It isn't included here to prevent any possible problem, but the link on XDA is always the same. (once there is a new version, then the old one is moved to the Archive subfolder.

ale5000-git commented 1 year ago

@amo13 I have got an idea that may work, using getprop and setprop some settings can be configured (these settings will survive only until a reboot). I will implement it when I have time.

amo13 commented 1 year ago

I have got an idea that may work, using getprop and setprop some settings can be configured (these settings will survive only until a reboot). I will implement it when I have time.

That sounds like a great idea!

And thanks for the permalink to androidfilehost. I'll try to use thatonce they resolve their Fatal error: Uncaught Error: Call to a member function execute() on null in /web/libs/classes/SqlCache.php:16 :laughing:

amo13 commented 1 year ago

Can't download programmatically from androidfilehost. They have an api but you need a key for direct download of files and only developers with beta access get one right now... I will host the full version and the google sync adapters on my server and will let my application download them from there.

ale5000-git commented 1 year ago

I have written the code to set LIVE_SETUP_TIMEOUT, but the new version of the zip isn't ready yet.

When it is released you will be able to set it with: adb shell "setprop zip.microg-unofficial-installer.LIVE_SETUP_TIMEOUT 0"

amo13 commented 1 year ago

Amazing! This solution is so much more elegant than sending a configuration file, which I needed to do for nanodroid.

Is it possible to configure INSTALL_FDROIDPRIVEXT and INSTALL_NEWPIPE the same way? For example for skipping newpipe installation.

ale5000-git commented 1 year ago

Now it should work with all settings:

adb shell "setprop zip.microg-unofficial-installer.LIVE_SETUP_DEFAULT 0"
adb shell "setprop zip.microg-unofficial-installer.LIVE_SETUP_TIMEOUT 0"
adb shell "setprop zip.common.DEBUG_LOG 1"
adb shell "setprop zip.microg-unofficial-installer.INSTALL_FDROIDPRIVEXT 1"
adb shell "setprop zip.microg-unofficial-installer.INSTALL_AURORASERVICES 1"
adb shell "setprop zip.microg-unofficial-installer.INSTALL_NEWPIPE 1"
adb shell "setprop zip.microg-unofficial-installer.INSTALL_PLAYSTORE 1"
adb shell "setprop zip.microg-unofficial-installer.INSTALL_ANDROIDAUTO 1"

Setting to an empty value reset the setting to default: adb shell "setprop zip.microg-unofficial-installer.INSTALL_FDROIDPRIVEXT ''"

Everything is resetted on restart.

amo13 commented 1 year ago

Wow, this is awesome! Great work, thank you!

ale5000-git commented 1 year ago

@amo13 Some infos for better error handling:

setprop works only as root; TWRP that I know already start as root but who knows.

To be more sure you can run: adb shell "whoami" and then check that the result is root

adb shell does NOT properly forward the return value on old ROMs (maybe also on old recoveries) so you can check that the command is working with: adb shell "setprop zip.microg-unofficial-installer.INSTALL_PLAYSTORE 1 2> /dev/null && echo OK || echo ERROR" and then checking the output.

ale5000-git commented 1 year ago

Everything is fixed now, it will be ported to the Google Sync add-on soon as well.

amo13 commented 1 year ago

Wow, this is awesome! Great work, thank you!

amo13 commented 1 year ago

The integration of your microG installer in my application is done. I've made your installer the default choice because it's more up-to-date than MinMicroG. But I'll wait for your next packaged release to release the update to my application because it downloads your installer automatically from the github releases page and it needs the new features from this issue.

Anyway, cheers... :clinking_glasses:

ale5000-git commented 1 year ago

@amo13 Hi, I have released a new version of microG unofficial installer.

Looking at your code the full version is downloaded if Chk_gsync.Checked || Chk_playstore.Checked but the full version contains in addition just Play Store and Android Auto so it isn't related to gsync that is a separate add-on.

amo13 commented 1 year ago

You are right. I appreciate the review!

ale5000-git commented 1 year ago

There is another issue that I noticed now but it is just minor, here it seems to open the MinMicroG page for my installer. If you need a page that show the content, then it is here: https://github.com/micro5k/microg-unofficial-installer/blob/main/zip-content/CONTENTS.rst

Edit: There is also a mirror for the full version in case the main download fail.

amo13 commented 1 year ago

Thank you, fixed it. It's going to be published in the next release.