Make ipfs path configurable

This commit is contained in:
Jochen Sprickerhof 2023-06-06 14:17:04 +02:00
parent 92612f3565
commit 6b1bb9ced5
No known key found for this signature in database
GPG Key ID: 5BFFDCC258E69433
3 changed files with 26 additions and 11 deletions

View File

@ -619,14 +619,13 @@ ipfs:
- cd /tmp
- wget https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz
- tar -xvzf kubo_v0.20.0_linux-amd64.tar.gz
- export PATH=/tmp/kubo:$PATH
- ipfs init
- /tmp/kubo/ipfs init
- test -d /tmp/fdroid/repo || mkdir -p /tmp/fdroid/repo
- cp $FDROIDSERVER/tests/config.py $FDROIDSERVER/tests/keystore.jks /tmp/fdroid/
- cp $FDROIDSERVER/tests/repo/com.politedroid_6.apk /tmp/fdroid/repo/
- cd /tmp/fdroid
- 'printf "ipfs = True\n" >> config.py'
- 'echo ipfs = \"/tmp/kubo/ipfs\" >> config.py'
- $FDROIDSERVER/fdroid update --verbose --create-metadata
- $FDROIDSERVER/fdroid deploy --verbose
- ipfs files ls /repo
- ipfs files ls /repo/com.politedroid_6.apk
- /tmp/kubo/ipfs files ls /repo
- /tmp/kubo/ipfs files ls /repo/com.politedroid_6.apk

View File

@ -268,11 +268,11 @@
# awssecretkey: {env: awssecretkey}
# To deploy to IPFS you need the ipfs command line utility in $PATH and have a
# `ipfs daemon` running. To serve the repo permanently, you either need to keep
# the daemon running or use a pinning service.
# To deploy to IPFS you need the ipfs command line utility and specify
# the path as an argument. To serve the repo permanently, you either need to
# keep the daemon running or use a pinning service.
#
# ipfs: true
# ipfs: /path/to/ipfs
# If you want to force 'fdroid server' to use a non-standard serverwebroot.

View File

@ -333,7 +333,16 @@ def update_ipfs(repo_section):
logging.debug(_('adding {section} to ipfs').format(section=repo_section))
return subprocess.check_output(
['ipfs', 'add', '-r', '-Q', '--to-files', f"/{repo_section}", repo_section], text=True
[
config.get("ipfs"),
'add',
'-r',
'-Q',
'--to-files',
f"/{repo_section}",
repo_section,
],
text=True,
).strip()
@ -346,7 +355,14 @@ def update_ipns(ipfs_hash, ipns_key):
)
subprocess.check_call(
['ipfs', 'name', 'publish', '--key', ipns_key, '/ipfs/{}'.format(ipfs_hash)]
[
config.get("ipfs"),
'name',
'publish',
'--key',
ipns_key,
'/ipfs/{}'.format(ipfs_hash),
]
)