Using F-droid from the command line via adb

Is there a way to use F-droid from the command line via adb?

For some context, I want to create a script to automatically install everything I use an do other configurations when I use a new device, instead of doing it manually.

1 Like

Hi!
I use My App List for that.

https://f-droid.org/packages/com.projectsexception.myapplist.open

Not claiming to be a bash expert, but it works for me:

#!/bin/bash

# Do this once 
#adb shell 'pm list packages -f' | grep data > current_list_of_apps

repo="https://ftp.osuosl.org/pub/fdroid/repo"

   mkdir -p tmp
    [ "$oldRepo" != "$repo" ] && rm -f tmp/index.xml
    oldRepo="$repo"
   if [ ! -f tmp/index.xml ];then
      wget --quiet --connect-timeout=10 $repo/index.jar -O tmp/index.jar
      unzip -p tmp/index.jar index.xml > tmp/index.xml
   fi
   grep versioncode  tmp/index.xml | awk -F"apkname" '{print $2}'  | sed 's/[<]//'|  sed 's/[>]//' | sed 's/[/]//' > fdroid_list_of_all_apks

for i in `cat current_list_of_apps`
do
   if grep "$i" fdroid_list_of_all_apks > /dev/null
       then
       echo "$i"
       TODOWNLOAD_APK=`grep "$i" fdroid_list_of_all_apks | head -1`
       wget --quiet --no-use-server-timestamps --connect-timeout=10 $repo"$TODOWNLOAD_APK" -O $i".apk"
       adb install $i".apk"
       sleep 5
   fi
done

Thank you all for your suggestions. All 3 methods are great for different situations.

In my case, I ended up creating a mix of the last 2 answers, creating a script to use fdroidcl to install all apps from a list and it’s working fine.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.