fdroidcl icon indicating copy to clipboard operation
fdroidcl copied to clipboard

set installer?

Open whitis opened this issue 5 years ago • 3 comments

Installer is currently set to null. Seems like you can do better than that although fdroid doesn't do very well either since it uses an external app to actually install unlike google play and amazon app store.

fdroid was installed using fdroidcl

adb shell pm list packages -i -f -U | fgrep -i fdroid package:/data/app/org.fdroid.fdroid-iuAasAj9JZFxU3XWeoSptQ==/base.apk=org.fdroid.fdroid installer=null uid:10473

antenna pod was manually installed using f-droid app

adb shell pm list packages -i -f -U | fgrep -i antenna package:/data/app/de.danoeh.antennapod-ipm6qV5SdjpZAUEcvlRjog==/base.apk=de.danoeh.antennapod installer=com.google.android.packageinstaller uid:10474

This was an example I found of how to set the installer when installing via adb adb shell pm install -i "com.android.vending" -r /data/local/tmp/app.apk but with that you need to push the file across first, unlike adb install. The -r will reinstall

the following options looked interesting

--originating-uri: set URI where app was downloaded from --referrer: set URI that instigated the install of the app

whitis avatar Jul 15 '20 00:07 whitis

Sure, patches are welcome. There are already some tests, which use a device connected over ADB.

mvdan avatar Jul 15 '20 19:07 mvdan

Starting with Android 12, setting the installer has a practical use case, see https://github.com/NeoApplications/Neo-Store/issues/20

I propose allowing the user to configure which installer they want to set, maybe even default to Neo-Store because setting it to fdroidcl is not an Android app thus cannot make use of Android 12+ auto update and F-Droid currently cannot auto update apps.

I tested this all with adb and I even patched fdroidcl to set Neo-Store as installer. This works great and allows to bulk install apps with fdroidcl and then letting Neo-Store auto update the apps in the background (for apps that target a recent enough API level, ref: https://github.com/NeoApplications/Neo-Store/issues/20). I am amazed how far we have gotten with Open Source, de-googled Android! Unfortunately my patch is quick and dirty (https://github.com/ypid/fdroidcl/tree/feature/set-installer-quick-and-dirty) and my golang knowledge is very limited.

Optionally, it would be cool if fdroidcl could retroactively change the installer for already installed apps. Note that fdroidcl install -u already updates the installer when updating an app, but you might want to switch all installed apps once. The logic for this can look like the following:

  1. Get a list of all F-Droid installed apps that currently have no installer set. I tested with adb shell pm list packages -3 -i --user 0 | grep 'installer=null' | sed --regexp-extended 's/package:([^ ]+).*/\1/;' but that is not a good default.
  2. Reinstall the latest version with the installer set. I tested this with adb install --user 0 -i com.machiav3lli.fdroid -r ./${myapp}.apk, works great even if that version is already installed. adb shell pm set-installer fails with "java.lang.SecurityException: Caller does not have same cert as new installer package com.machiav3lli.fdroid" on my phone but it probably does not hurt to try that first.

ypid avatar May 07 '23 21:05 ypid