Skip to content

Instantly share code, notes, and snippets.

@matsimon
Last active January 29, 2017 16:38
Show Gist options
  • Save matsimon/f177bd90b3cc7f1d0635 to your computer and use it in GitHub Desktop.
Save matsimon/f177bd90b3cc7f1d0635 to your computer and use it in GitHub Desktop.
Requires
- fddroidserver and basic requirements for binary repo (see their page)
- follow instrunctions to create a basic repo structure for a binary-only repo
- the android sdk of which you mostly need aapt and its libc++.so + local libraries to make it run
the SDK itself isn't redistirbutable mostly, get your own copy.
For the aapt I use ldd shows following libraries are needed on a Debian amd64 system:
ldd /opt/android-sdk-linux-mini/build-tools/23.0.1/aapt
linux-gate.so.1 (0xf774a000)
libc++.so => /opt/android-sdk-linux-mini/build-tools/23.0.1/lib/libc++.so (0xf756c000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf755a000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf7554000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7538000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf751b000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf74d5000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf74b8000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf730a000)
/lib/ld-linux.so.2 (0xf774d000)
- working config.py in the repository, again see the fdroid documentation
- populate the metadata directory, at a metadata file for each app you add
And finally in the repo all you need to do is
/path-to/fdroidserver/fdroid update -v --pretty
Then you can add the http://yourlocalserver/fdroid/repo to your repos in F-Droid
#!/usr/bin/env python3
# To be put inside the racoon folder
import os
from shutil import move
from subprocess import call
raccoon_path = '/opt/raccoon'
# Generic is the folder name in the 'archives' folder of racoon
archives = (['Generic','VendorA.MyModelX','VendorB.MyModelY'])
repo_folder = '/var/www/fdroid/repo'
for archive in archives:
this_archive = 'archives/' + archive
print('Updating: ' + archive)
call(['java','-jar','raccoon-3.5.jar','-u','-a',this_archive])
new_apks = []
for archive in archives:
log_path = raccoon_path + '/archives/' + archive + '/' + 'logs/downloads-complete.txt'
try:
f = open(log_path, 'r')
except IOError:
print('Archive \'' + archive + '\' has no new apks')
else:
for line in f:
new_apks.append( line.rstrip('\n') )
for apk in new_apks:
if (os.path.getsize(apk) >=1):
# Don't move anything, that's already a placholder
# to fool Raccon and stop it from wasting space
print('Moving: ' + apk + ' to ' + repo_folder)
move(apk,repo_folder)
# Make empty files so Racconn doesn't re-download this apk
file = open(apk, 'w+')
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment