This commit is contained in:
CanbiZ 2025-04-30 10:30:21 +02:00
parent b9e5bbf00f
commit 1ffb95ca59
3 changed files with 778 additions and 731 deletions

View File

@ -25,15 +25,9 @@ function update_script() {
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \
"1" "Update Paperless-ngx to $RELEASE" ON \
"2" "Paperless-ngx Credentials" OFF \
3>&1 1>&2 2>&3)
header_info
check_container_storage
check_container_resources
if [ "$UPD" == "1" ]; then
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
if [[ "$(gs --version 2>/dev/null)" != "10.04.0" ]]; then
msg_info "Updating Ghostscript (Patience)"

View File

@ -52,15 +52,17 @@ $STD apt-get install -y \
zlib1g \
tesseract-ocr \
tesseract-ocr-eng
cd /tmp
curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10051/ghostpdl-10.05.1.tar.gz" -o "ghostscript.tar.gz"
tar -xzf ghostscript.tar.gz
cd ghostpdl-10.05.1
$STD ./configure
$STD make
$STD make install
# cd /tmp
# curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10051/ghostpdl-10.05.1.tar.gz" -o "ghostscript.tar.gz"
# tar -xzf ghostscript.tar.gz
# cd ghostpdl-10.05.1
# $STD ./configure
# $STD make
# $STD make install
msg_ok "Installed OCR Dependencies"
setup_gs
msg_info "Installing JBIG2"
$STD git clone https://github.com/ie13/jbig2enc /opt/jbig2enc
cd /opt/jbig2enc

View File

@ -846,3 +846,54 @@ function ensure_usr_local_bin_persist() {
chmod +x "$PROFILE_FILE"
fi
}
function setup_gs() {
msg_info "Setup Ghostscript"
local TMP_DIR
TMP_DIR=$(mktemp -d)
local CURRENT_VERSION
CURRENT_VERSION=$(gs --version 2>/dev/null || echo "0")
local LATEST_VERSION
LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/ArtifexSoftware/ghostpdl-downloads/releases/latest |
grep '"tag_name":' | cut -d '"' -f4 | sed 's/^gs//')
if [[ -z "$LATEST_VERSION" ]]; then
msg_error "Could not determine latest Ghostscript version from GitHub."
rm -rf "$TMP_DIR"
return
fi
if dpkg --compare-versions "$CURRENT_VERSION" ge "$LATEST_VERSION"; then
msg_ok "Ghostscript is already at version $CURRENT_VERSION"
rm -rf "$TMP_DIR"
return
fi
msg_info "Installing/Updating Ghostscript to $LATEST_VERSION"
curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${LATEST_VERSION}/ghostpdl-${LATEST_VERSION}.tar.gz" \
-o "$TMP_DIR/ghostscript.tar.gz"
if ! tar -xzf "$TMP_DIR/ghostscript.tar.gz" -C "$TMP_DIR"; then
msg_error "Failed to extract Ghostscript archive."
rm -rf "$TMP_DIR"
return
fi
cd "$TMP_DIR/ghostpdl-${LATEST_VERSION}" || {
msg_error "Failed to enter Ghostscript source directory."
rm -rf "$TMP_DIR"
return
}
./configure >/dev/null && make -s && make install >/dev/null
local EXIT_CODE=$?
rm -rf "$TMP_DIR"
if [[ $EXIT_CODE -eq 0 ]]; then
msg_ok "Ghostscript installed/updated to version $LATEST_VERSION"
else
msg_error "Ghostscript installation failed"
fi
}