diff --git a/entrypoint.sh b/entrypoint.sh index bc9a02d..25b00a9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,10 +9,26 @@ set -eu . /etc/profile.d/bsenv.sh +# Pre-update cleanup: sweep hashed index files left by the prior rehash run. +# Otherwise fdroidserver's scan_repo_files() picks them up as installable +# items (their .json extension passes is_repo_file(), since the hashed name +# isn't in its ignore list) and a bogus "index-v2-" package shows up +# in the index. We check every arg (not just $1) so global flags before the +# subcommand (e.g. `-v update`) still trigger this. +for arg in "$@"; do + if [ "$arg" = "update" ]; then + for repodir in repo archive; do + if [ -d "$repodir" ]; then + rm -f "$repodir"/index-v2-*.json "$repodir"/index-v2-*.json.asc + fi + done + break + fi +done + GRADLE_USER_HOME="${home_vagrant}/.gradle" "${fdroidserver}/fdroid" "$@" -# Auto-rehash after a successful update. We check every arg (not just $1) -# so global flags before the subcommand (e.g. `-v update`) still trigger it. +# Auto-rehash after a successful update. for arg in "$@"; do if [ "$arg" = "update" ]; then fdroidserver-ipfs-rehash