From 0a157d1c018800986439f7dce43e8e9ae394deb0 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Sun, 24 Jun 2018 05:47:24 -0500 Subject: [PATCH] Support .fdroid.yml. --- README.md | 4 +++- entrypoint | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5ebeb07..b7c4ed6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ The `fdroiddata` is placed into `/fdroiddata`. Should produce the `org.fdroid.fdroid` apk in `build`. ### Building in Repo -If you have a directory named `fdroid` at the root of your repository, its contents will be copied over into the `/fdroiddata/metadata` directory. Additionally, the token `%REPO` in all metadata files will be replaced with the path to the repo in the container. This is so the metadata file does not need to know the exact path the repo will live at during the build. +If you have a file named `.fdroid.yml` or `.fdroid.json` at the root of your repository, the build will be run right out of the repo using that metadata file; see [Running `fdroid build` in your app's source](https://f-droid.org/docs/Building_Applications/#running-fdroid-build-in-your-apps-source) (note that contrary to the doc, neither `.fdroid.txt` nor `.fdroid.xml` are supported anymore; thus, this image does not look for them). + +Else, if you have a directory named `fdroid` at the root of your repository, its contents will be copied over into the `/fdroiddata/metadata` directory. Additionally, the token `%REPO` in all metadata files will be replaced with the path to the repo in the container. This is so the metadata file does not need to know the exact path the repo will live at during the build. A F-Droid metadata file is named `.txt` and [looks like this](https://gitlab.com/fdroid/fdroiddata/blob/master/templates/app-full). So, if you have such a file located at `fdroid/net.monarchpass.app.txt`, you should be able to run this: diff --git a/entrypoint b/entrypoint index bd850d5..14b4d09 100644 --- a/entrypoint +++ b/entrypoint @@ -3,10 +3,13 @@ REPO="$(pwd)" export PATH="/opt/gradle/bin:$PATH" -if [ -d "fdroid" ]; then - cp -Rv fdroid/* /fdroiddata/metadata; +if [ ! -f ".fdroid.yml" ] && [ ! -f ".fdroid.json" ]; then + if [ -d "fdroid" ]; then + cp -Rv fdroid/* /fdroiddata/metadata; + fi + + cd /fdroiddata + find ./metadata -type f -name "*.txt" -exec sed -i "s:%REPO:$REPO:g" {} + fi -cd /fdroiddata -find ./metadata -type f -name "*.txt" -exec sed -i "s:%REPO:$REPO:g" {} + -fdroid $@ +fdroid "$@"