Files
ProxmoxVE/install/apache-tika-install.sh
Mark Munro 7462256893 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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>
Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com>
2026-08-25 11:23:25 +02:00

67 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Andy Grunwald (andygrunwald)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/apache/tika/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
gdal-bin \
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-ita \
tesseract-ocr-fra \
tesseract-ocr-spa \
tesseract-ocr-deu
$STD echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
$STD apt-get install -y \
xfonts-utils \
fonts-freefont-ttf \
fonts-liberation \
ttf-mscorefonts-installer \
cabextract
msg_ok "Installed Dependencies"
JAVA_VERSION="21" setup_java
msg_info "Installing Apache Tika"
RELEASE="$(curl -fsSL https://dlcdn.apache.org/tika/ | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")' | sort -V | tail -n1)"
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"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/apache-tika.service
[Unit]
Description=Apache Tika
Documentation=https://tika.apache.org/
After=syslog.target network.target
[Service]
User=root
Restart=always
Type=simple
ExecStart=java -jar /opt/apache-tika/tika-server-standard.jar --host 0.0.0.0 --port 9998
ExecReload=/bin/kill -HUP \$MAINPID
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now apache-tika
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc