Skip to content

Commit 4777843

Browse files
Munza2020claude
andcommitted
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 <noreply@anthropic.com>
1 parent 433534d commit 4777843

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

ct/apache-tika.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ function update_script() {
3535
msg_ok "Stopped Service"
3636

3737
msg_info "Updating ${APP} to v${RELEASE}"
38-
cd /opt/apache-tika
39-
curl -fsSL -o tika-server-standard-${RELEASE}.jar "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.jar"
40-
mv --force tika-server-standard.jar tika-server-standard-prev-version.jar
41-
mv tika-server-standard-${RELEASE}.jar tika-server-standard.jar
42-
rm -rf /opt/apache-tika/tika-server-standard-prev-version.jar
38+
# As of 4.0.0, upstream ships tika-server-standard as a zip instead of a
39+
# standalone jar: tika-server-standard-<version>.jar inside it is a thin
40+
# launcher whose manifest Class-Path depends on a sibling lib/ (and
41+
# plugins/) directory that has to move in lockstep with it.
42+
# fetch_and_deploy_from_url handles the zip/tar/deb extraction itself;
43+
# CLEAN_INSTALL=1 replaces the whole directory instead of leaving the
44+
# previous version's lib/ jars mixed in with the new ones.
45+
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.zip" /opt/apache-tika
46+
mv "/opt/apache-tika/tika-server-standard-${RELEASE}.jar" /opt/apache-tika/tika-server-standard.jar
4347
echo "${RELEASE}" >/opt/${APP}_version.txt
4448
msg_ok "Updated ${APP} to v${RELEASE}"
4549

install/apache-tika-install.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ msg_ok "Installed Dependencies"
3535
JAVA_VERSION="21" setup_java
3636

3737
msg_info "Installing Apache Tika"
38-
mkdir -p /opt/apache-tika
39-
cd /opt/apache-tika
4038
RELEASE="$(curl -fsSL https://dlcdn.apache.org/tika/ | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")' | sort -V | tail -n1)"
41-
curl -fsSL "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.jar" -o tika-server-standard-${RELEASE}.jar
42-
mv tika-server-standard-${RELEASE}.jar tika-server-standard.jar
39+
# As of 4.0.0, upstream ships tika-server-standard as a zip instead of a
40+
# standalone jar: tika-server-standard-<version>.jar inside it is a thin
41+
# launcher whose manifest Class-Path depends on a sibling lib/ (and
42+
# plugins/) directory that has to be deployed alongside it -
43+
# fetch_and_deploy_from_url handles that extraction.
44+
fetch_and_deploy_from_url "https://dlcdn.apache.org/tika/${RELEASE}/tika-server-standard-${RELEASE}.zip" /opt/apache-tika
45+
mv "/opt/apache-tika/tika-server-standard-${RELEASE}.jar" /opt/apache-tika/tika-server-standard.jar
4346
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
4447
msg_ok "Installed Apache Tika"
4548

0 commit comments

Comments
 (0)