Files
ProxmoxVE/ct/apache-tika.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

61 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# 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/
APP="Apache-Tika"
var_tags="${var_tags:-document}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-10}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /etc/systemd/system/apache-tika.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE="$(curl -fsSL https://dlcdn.apache.org/tika/ | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")' | sort -V | tail -n1)"
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Service"
systemctl stop apache-tika
msg_ok "Stopped Service"
msg_info "Updating ${APP} to v${RELEASE}"
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}"
msg_info "Starting Service"
systemctl start apache-tika
msg_ok "Started Service"
msg_ok "Updated successfully!"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
}
start
build_container
description
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:9998${CL}"