From 74622568934c79d4c2407b7f02b3d626685b6ad2 Mon Sep 17 00:00:00 2001 From: Mark Munro <73947246+Munza2020@users.noreply.github.com> Date: Tue, 25 Aug 2026 10:23:25 +0100 Subject: [PATCH] fix(apache-tika): handle upstream's switch from jar to zip distribution (#16726) * fix(apache-tika): handle upstream's switch from jar to zip distribution Apache Tika 4.0.0 stopped publishing tika-server-standard as a standalone executable jar and now ships it as a zip: the jar inside is a thin launcher whose manifest Class-Path resolves ~150 dependencies from a sibling lib/ (and plugins/) directory, so downloading just the jar 404s and, even if it didn't, would no longer be runnable on its own. Both install and update now use fetch_and_deploy_from_url (already used by several other scripts in this repo, e.g. ct/technitiumdns.sh) to fetch and extract the whole archive in place, instead of hand-rolling curl+unzip. update_script() also passes CLEAN_INSTALL=1 so a later update replaces the lib/ tree wholesale rather than layering a new version's jars on top of an old one's. Verified by running the real ct/apache-tika.sh (via build.func/tools.func pulled live from this repo's main) against a live LXC container previously on 3.3.2: it downloads and extracts the 4.0.0 zip, starts the service, and `java -jar tika-server-standard.jar` answers on port 9998 with "Apache Tika 4.0.0". Co-Authored-By: Claude Sonnet 5 * Clean up comments in apache-tika.sh Removed outdated comments regarding tika-server-standard installation method. * Update Apache Tika installation script Removed comments regarding the change in Apache Tika packaging and updated the installation process. --------- Co-authored-by: Claude Sonnet 5 Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com> --- ct/apache-tika.sh | 7 ++----- install/apache-tika-install.sh | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ct/apache-tika.sh b/ct/apache-tika.sh index 4d731da8e..9b6daf3c2 100755 --- a/ct/apache-tika.sh +++ b/ct/apache-tika.sh @@ -35,11 +35,8 @@ function update_script() { msg_ok "Stopped Service" msg_info "Updating ${APP} to v${RELEASE}" - cd /opt/apache-tika - curl -fsSL -o tika-server-standard-${RELEASE}.jar "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.jar" - mv --force tika-server-standard.jar tika-server-standard-prev-version.jar - mv tika-server-standard-${RELEASE}.jar tika-server-standard.jar - rm -rf /opt/apache-tika/tika-server-standard-prev-version.jar + CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.zip" /opt/apache-tika + mv "/opt/apache-tika/tika-server-standard-${RELEASE}.jar" /opt/apache-tika/tika-server-standard.jar echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated ${APP} to v${RELEASE}" diff --git a/install/apache-tika-install.sh b/install/apache-tika-install.sh index 5c277e2bf..9577eb6a9 100644 --- a/install/apache-tika-install.sh +++ b/install/apache-tika-install.sh @@ -35,11 +35,9 @@ msg_ok "Installed Dependencies" JAVA_VERSION="21" setup_java msg_info "Installing Apache Tika" -mkdir -p /opt/apache-tika -cd /opt/apache-tika RELEASE="$(curl -fsSL https://dlcdn.apache.org/tika/ | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")' | sort -V | tail -n1)" -curl -fsSL "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.jar" -o tika-server-standard-${RELEASE}.jar -mv tika-server-standard-${RELEASE}.jar tika-server-standard.jar +fetch_and_deploy_from_url "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.zip" /opt/apache-tika +mv "/opt/apache-tika/tika-server-standard-${RELEASE}.jar" /opt/apache-tika/tika-server-standard.jar echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Installed Apache Tika"