cleanup
This commit is contained in:
		
							parent
							
								
									6c602da50f
								
							
						
					
					
						commit
						f9d60db88e
					
				| @ -1,56 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: MickLesk (Canbiz) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://ersatztv.org/ | ||||
| 
 | ||||
| APP="ErsatzTV" | ||||
| var_tags="${var_tags:-iptv}" | ||||
| var_cpu="${var_cpu:-2}" | ||||
| var_ram="${var_ram:-1024}" | ||||
| var_disk="${var_disk:-5}" | ||||
| var_os="${var_os:-debian}" | ||||
| var_version="${var_version:-12}" | ||||
| var_unprivileged="${var_unprivileged:-1}" | ||||
| 
 | ||||
| header_info "$APP" | ||||
| variables | ||||
| color | ||||
| catch_errors | ||||
| function update_script() { | ||||
|   header_info | ||||
|   check_container_storage | ||||
|   check_container_resources | ||||
|   if [[ ! -d /opt/ErsatzTV ]]; then | ||||
|     msg_error "No ${APP} Installation Found!" | ||||
|     exit | ||||
|   fi | ||||
|   RELEASE=$(curl -fsSL https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1) | ||||
|   if [[ "${RELEASE}" != "$(cat ~/.ersatztv 2>/dev/null)" ]] || [[ ! -f ~/.ersatztv ]]; then | ||||
|     msg_info "Stopping ErsatzTV" | ||||
|     systemctl stop ersatzTV | ||||
|     msg_ok "Stopped ErsatzTV" | ||||
| 
 | ||||
|     FFMPEG_VERSION="latest" FFMPEG_TYPE="medium" setup_ffmpeg | ||||
|     fetch_and_deploy_gh_release "ersatztv" "ErsatzTV/ErsatzTV" "prebuild" "latest" "/opt/ErsatzTV" "*linux-x64.tar.gz" | ||||
| 
 | ||||
|     msg_info "Starting ErsatzTV" | ||||
|     systemctl start ersatzTV | ||||
|     msg_ok "Started ErsatzTV" | ||||
| 
 | ||||
|     msg_ok "Updated Successfully" | ||||
|   else | ||||
|     msg_ok "No update required. ${APP} is already at ${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 "${TAB}${GATEWAY}${BGN}http://${IP}:8409${CL}" | ||||
| @ -1,81 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: havardthom | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://openwebui.com/ | ||||
| 
 | ||||
| APP="Open WebUI" | ||||
| var_tags="${var_tags:-ai;interface}" | ||||
| var_cpu="${var_cpu:-4}" | ||||
| var_ram="${var_ram:-8192}" | ||||
| var_disk="${var_disk:-25}" | ||||
| var_os="${var_os:-debian}" | ||||
| var_version="${var_version:-12}" | ||||
| var_unprivileged="${var_unprivileged:-1}" | ||||
| 
 | ||||
| header_info "$APP" | ||||
| variables | ||||
| color | ||||
| catch_errors | ||||
| 
 | ||||
| function update_script() { | ||||
|   header_info | ||||
|   check_container_storage | ||||
|   check_container_resources | ||||
|   if [[ ! -d /opt/open-webui ]]; then | ||||
|     msg_error "No ${APP} Installation Found!" | ||||
|     exit | ||||
|   fi | ||||
| 
 | ||||
|   if [ -x "/usr/bin/ollama" ]; then | ||||
|     msg_info "Updating Ollama" | ||||
|     OLLAMA_VERSION=$(ollama -v | awk '{print $NF}') | ||||
|     RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') | ||||
|     if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then | ||||
|       rm -rf /usr/lib/ollama | ||||
|       rm -rf /usr/bin/ollama | ||||
|       curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz | ||||
|       tar -C /usr -xzf ollama-linux-amd64.tgz | ||||
|       rm -rf ollama-linux-amd64.tgz | ||||
|       msg_ok "Ollama updated to version $RELEASE" | ||||
|     else | ||||
|       msg_ok "Ollama is already up to date." | ||||
|     fi | ||||
|   fi | ||||
| 
 | ||||
|   msg_info "Updating ${APP} (Patience)" | ||||
|   cd /opt/open-webui | ||||
|   mkdir -p /opt/open-webui-backup | ||||
|   cp -rf /opt/open-webui/backend/data /opt/open-webui-backup | ||||
|   git add -A | ||||
|   $STD git stash | ||||
|   $STD git reset --hard | ||||
|   output=$(git pull --no-rebase) | ||||
|   if echo "$output" | grep -q "Already up to date."; then | ||||
|     msg_ok "$APP is already up to date." | ||||
|     exit | ||||
|   fi | ||||
|   systemctl stop open-webui.service | ||||
|   $STD npm install | ||||
|   export NODE_OPTIONS="--max-old-space-size=3584" | ||||
|   $STD npm run build | ||||
|   cd ./backend | ||||
|   $STD pip install -r requirements.txt -U | ||||
|   cp -rf /opt/open-webui-backup/* /opt/open-webui/backend | ||||
|   if git stash list | grep -q 'stash@{'; then | ||||
|     $STD git stash pop | ||||
|   fi | ||||
|   systemctl start open-webui.service | ||||
|   msg_ok "Updated Successfully" | ||||
|   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 "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" | ||||
| @ -1,62 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: tteck (tteckster) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://www.stirlingpdf.com/ | ||||
| 
 | ||||
| APP="Stirling-PDF" | ||||
| var_tags="${var_tags:-pdf-editor}" | ||||
| var_cpu="${var_cpu:-2}" | ||||
| var_ram="${var_ram:-2048}" | ||||
| var_disk="${var_disk:-8}" | ||||
| var_os="${var_os:-debian}" | ||||
| var_version="${var_version:-12}" | ||||
| var_unprivileged="${var_unprivileged:-1}" | ||||
| 
 | ||||
| header_info "$APP" | ||||
| variables | ||||
| color | ||||
| catch_errors | ||||
| 
 | ||||
| function update_script() { | ||||
|   header_info | ||||
|   check_container_storage | ||||
|   check_container_resources | ||||
|   if [[ ! -d /opt/Stirling-PDF ]]; then | ||||
|     msg_error "No ${APP} Installation Found!" | ||||
|     exit | ||||
|   fi | ||||
|   msg_info "Updating ${APP}" | ||||
|   systemctl stop stirlingpdf | ||||
|   if [[ -n $(dpkg -l | grep -w ocrmypdf) ]] && [[ -z $(dpkg -l | grep -w qpdf) ]]; then | ||||
|     $STD apt-get remove -y ocrmypdf | ||||
|     $STD apt-get install -y qpdf | ||||
|   fi | ||||
|   RELEASE=$(curl -fsSL https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') | ||||
|   curl -fsSL "https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz" -o $(basename "https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz") | ||||
|   tar -xzf v$RELEASE.tar.gz | ||||
|   cd Stirling-PDF-$RELEASE | ||||
|   chmod +x ./gradlew | ||||
|   $STD ./gradlew build -x spotlessApply -x spotlessCheck -x test -x sonarqube | ||||
|   rm -rf /opt/Stirling-PDF/Stirling-PDF-*.jar | ||||
|   cp -r ./stirling-pdf/build/libs/*.jar /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar | ||||
|   cp -r scripts /opt/Stirling-PDF/ | ||||
|   cp -r pipeline /opt/Stirling-PDF/ | ||||
|   cp -r stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ | ||||
|   cd ~ | ||||
|   rm -rf Stirling-PDF-$RELEASE v$RELEASE.tar.gz | ||||
|   ln -sf /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar /opt/Stirling-PDF/Stirling-PDF.jar | ||||
|   systemctl start stirlingpdf | ||||
|   msg_ok "Updated ${APP} to v$RELEASE" | ||||
|   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 "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" | ||||
| @ -1,85 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: tteck (tteckster) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://github.com/TriliumNext/Trilium | ||||
| 
 | ||||
| APP="Trilium" | ||||
| var_tags="${var_tags:-notes}" | ||||
| var_cpu="${var_cpu:-1}" | ||||
| var_ram="${var_ram:-512}" | ||||
| var_disk="${var_disk:-2}" | ||||
| var_os="${var_os:-debian}" | ||||
| var_version="${var_version:-12}" | ||||
| var_unprivileged="${var_unprivileged:-1}" | ||||
| 
 | ||||
| header_info "$APP" | ||||
| variables | ||||
| color | ||||
| catch_errors | ||||
| 
 | ||||
| function update_script() { | ||||
|   header_info | ||||
|   check_container_storage | ||||
|   check_container_resources | ||||
|   if [[ ! -d /opt/trilium ]]; then | ||||
|     msg_error "No ${APP} Installation Found!" | ||||
|     exit | ||||
|   fi | ||||
|   RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Trilium/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') | ||||
|   if [[ "${RELEASE}" != "$(cat ~/.Trilium 2>/dev/null)" ]] || [[ ! -f ~/.Trilium ]]; then | ||||
| 
 | ||||
|     if [[ -d /opt/trilium/db ]]; then | ||||
|       DB_PATH="/opt/trilium/db" | ||||
|       DB_RESTORE_PATH="/opt/trilium/db" | ||||
|     elif [[ -d /opt/trilium/assets/db ]]; then | ||||
|       DB_PATH="/opt/trilium/assets/db" | ||||
|       DB_RESTORE_PATH="/opt/trilium/assets/db" | ||||
|     else | ||||
|       msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db" | ||||
|       exit 1 | ||||
|     fi | ||||
| 
 | ||||
|     msg_info "Stopping ${APP}" | ||||
|     systemctl stop trilium | ||||
|     sleep 1 | ||||
|     msg_ok "Stopped ${APP}" | ||||
| 
 | ||||
|     msg_info "Backing up Database" | ||||
|     mkdir -p /opt/trilium_backup | ||||
|     cp -r "${DB_PATH}" /opt/trilium_backup/ | ||||
|     rm -rf /opt/trilium | ||||
|     msg_ok "Backed up Database" | ||||
| 
 | ||||
|     fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz" | ||||
| 
 | ||||
|     msg_info "Restoring Database" | ||||
|     mkdir -p "$(dirname "${DB_RESTORE_PATH}")" | ||||
|     cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}" | ||||
|     msg_ok "Restored Database" | ||||
| 
 | ||||
|     msg_info "Cleaning up" | ||||
|     rm -rf /opt/trilium_backup | ||||
|     msg_ok "Cleaned" | ||||
| 
 | ||||
|     msg_info "Starting ${APP}" | ||||
|     systemctl start trilium | ||||
|     sleep 1 | ||||
|     msg_ok "Started ${APP}" | ||||
|     msg_ok "Updated Successfully" | ||||
|   else | ||||
|     msg_ok "No update required. ${APP} is already at ${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 "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" | ||||
| @ -1,57 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: MickLesk (Canbiz) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://ersatztv.org/ | ||||
| 
 | ||||
| source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" | ||||
| color | ||||
| verb_ip6 | ||||
| catch_errors | ||||
| setting_up_container | ||||
| network_check | ||||
| update_os | ||||
| 
 | ||||
| FFMPEG_VERSION="latest" FFMPEG_TYPE="medium" setup_ffmpeg | ||||
| 
 | ||||
| msg_info "Setting Up Hardware Acceleration" | ||||
| $STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} | ||||
| if [[ "$CTTYPE" == "0" ]]; then | ||||
|   chgrp video /dev/dri | ||||
|   chmod 755 /dev/dri | ||||
|   chmod 660 /dev/dri/* | ||||
|   $STD adduser $(id -u -n) video | ||||
|   $STD adduser $(id -u -n) render | ||||
| fi | ||||
| msg_ok "Set Up Hardware Acceleration" | ||||
| 
 | ||||
| fetch_and_deploy_gh_release "ersatztv" "ErsatzTV/ErsatzTV" "prebuild" "latest" "/opt/ErsatzTV" "*linux-x64.tar.gz" | ||||
| 
 | ||||
| msg_info "Creating Service" | ||||
| cat <<EOF >/etc/systemd/system/ersatzTV.service | ||||
| [Unit] | ||||
| Description=ErsatzTV Service | ||||
| After=multi-user.target | ||||
| 
 | ||||
| [Service] | ||||
| Type=simple | ||||
| User=root | ||||
| WorkingDirectory=/opt/ErsatzTV | ||||
| ExecStart=/opt/ErsatzTV/ErsatzTV | ||||
| Restart=always | ||||
| RestartSec=30 | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| systemctl enable -q --now ersatzTV | ||||
| msg_ok "Created Service" | ||||
| 
 | ||||
| motd_ssh | ||||
| customize | ||||
| 
 | ||||
| msg_info "Cleaning up" | ||||
| $STD apt-get -y autoremove | ||||
| $STD apt-get -y autoclean | ||||
| msg_ok "Cleaned" | ||||
| @ -1,99 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: tteck | ||||
| # Co-Author: havardthom | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://openwebui.com/ | ||||
| 
 | ||||
| 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 \ | ||||
|   git \ | ||||
|   ffmpeg | ||||
| msg_ok "Installed Dependencies" | ||||
| 
 | ||||
| msg_info "Setup Python3" | ||||
| $STD apt-get install -y --no-install-recommends \ | ||||
|   python3 \ | ||||
|   python3-pip | ||||
| msg_ok "Setup Python3" | ||||
| 
 | ||||
| NODE_VERSION="22" setup_nodejs | ||||
| 
 | ||||
| msg_info "Installing Open WebUI (Patience)" | ||||
| $STD git clone https://github.com/open-webui/open-webui.git /opt/open-webui | ||||
| cd /opt/open-webui/backend | ||||
| $STD pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | ||||
| $STD pip3 install -r requirements.txt -U | ||||
| cd /opt/open-webui | ||||
| cp .env.example .env | ||||
| cat <<EOF >/opt/open-webui/.env | ||||
| ENV=prod | ||||
| ENABLE_OLLAMA_API=false | ||||
| OLLAMA_BASE_URL=http://0.0.0.0:11434 | ||||
| EOF | ||||
| $STD npm install | ||||
| export NODE_OPTIONS="--max-old-space-size=3584" | ||||
| $STD npm run build | ||||
| msg_ok "Installed Open WebUI" | ||||
| 
 | ||||
| read -r -p "${TAB3}Would you like to add Ollama? <y/N> " prompt | ||||
| if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then | ||||
|   msg_info "Installing Ollama" | ||||
|   curl -fsSLO https://ollama.com/download/ollama-linux-amd64.tgz | ||||
|   tar -C /usr -xzf ollama-linux-amd64.tgz | ||||
|   rm -rf ollama-linux-amd64.tgz | ||||
|   cat <<EOF >/etc/systemd/system/ollama.service | ||||
| [Unit] | ||||
| Description=Ollama Service | ||||
| After=network-online.target | ||||
| 
 | ||||
| [Service] | ||||
| Type=exec | ||||
| ExecStart=/usr/bin/ollama serve | ||||
| Environment=HOME=$HOME | ||||
| Environment=OLLAMA_HOST=0.0.0.0 | ||||
| Restart=always | ||||
| RestartSec=3 | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
|   systemctl enable -q --now ollama | ||||
|   sed -i 's/ENABLE_OLLAMA_API=false/ENABLE_OLLAMA_API=true/g' /opt/open-webui/.env | ||||
|   msg_ok "Installed Ollama" | ||||
| fi | ||||
| 
 | ||||
| msg_info "Creating Service" | ||||
| cat <<EOF >/etc/systemd/system/open-webui.service | ||||
| [Unit] | ||||
| Description=Open WebUI Service | ||||
| After=network.target | ||||
| 
 | ||||
| [Service] | ||||
| Type=exec | ||||
| WorkingDirectory=/opt/open-webui | ||||
| EnvironmentFile=/opt/open-webui/.env | ||||
| ExecStart=/opt/open-webui/backend/start.sh | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| systemctl enable -q --now open-webui | ||||
| msg_ok "Created Service" | ||||
| 
 | ||||
| motd_ssh | ||||
| customize | ||||
| 
 | ||||
| msg_info "Cleaning up" | ||||
| $STD apt-get -y autoremove | ||||
| $STD apt-get -y autoclean | ||||
| msg_ok "Cleaned" | ||||
| @ -1,201 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: tteck (tteckster) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://www.stirlingpdf.com/ | ||||
| 
 | ||||
| source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" | ||||
| color | ||||
| verb_ip6 | ||||
| catch_errors | ||||
| setting_up_container | ||||
| network_check | ||||
| update_os | ||||
| 
 | ||||
| msg_info "Installing Dependencies (Patience)" | ||||
| $STD apt-get install -y \ | ||||
|   automake \ | ||||
|   autoconf \ | ||||
|   libtool \ | ||||
|   libleptonica-dev \ | ||||
|   pkg-config \ | ||||
|   zlib1g-dev \ | ||||
|   make \ | ||||
|   g++ \ | ||||
|   unpaper \ | ||||
|   fonts-urw-base35 \ | ||||
|   qpdf \ | ||||
|   poppler-utils | ||||
| msg_ok "Installed Dependencies" | ||||
| 
 | ||||
| PYTHON_VERSION="3.12" setup_uv | ||||
| JAVA_VERSION="21" setup_java | ||||
| 
 | ||||
| read -r -p "${TAB3}Do you want to Stirling-PDF with Login? (no/n = without Login) [Y/n] " response | ||||
| response=${response,,} # Convert to lowercase | ||||
| login_mode="false" | ||||
| if [[ "$response" == "y" || "$response" == "yes" || -z "$response" ]]; then | ||||
|   USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF-with-login.jar" | ||||
|   mv /opt/Stirling-PDF/Stirling-PDF-with-login.jar /opt/Stirling-PDF/Stirling-PDF.jar | ||||
|   touch ~/.Stirling-PDF-login | ||||
|   login_mode="true" | ||||
| else | ||||
|   USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF.jar" | ||||
| fi | ||||
| 
 | ||||
| msg_info "Installing LibreOffice Components" | ||||
| $STD apt-get install -y \ | ||||
|   libreoffice-writer \ | ||||
|   libreoffice-calc \ | ||||
|   libreoffice-impress \ | ||||
|   libreoffice-core \ | ||||
|   libreoffice-common \ | ||||
|   libreoffice-base-core \ | ||||
|   libreoffice-script-provider-python \ | ||||
|   libreoffice-java-common \ | ||||
|   unoconv \ | ||||
|   pngquant \ | ||||
|   weasyprint | ||||
| msg_ok "Installed LibreOffice Components" | ||||
| 
 | ||||
| msg_info "Installing Python Dependencies" | ||||
| mkdir -p /tmp/stirling-pdf | ||||
| $STD uv venv /opt/.venv | ||||
| export PATH="/opt/.venv/bin:$PATH" | ||||
| source /opt/.venv/bin/activate | ||||
| $STD uv pip install --upgrade pip | ||||
| $STD uv pip install \ | ||||
|   opencv-python-headless \ | ||||
|   ocrmypdf \ | ||||
|   pillow \ | ||||
|   pdf2image | ||||
| 
 | ||||
| $STD apt-get install -y python3-uno python3-pip | ||||
| $STD pip3 install --break-system-packages unoserver | ||||
| ln -sf /opt/.venv/bin/python3 /usr/local/bin/python3 | ||||
| ln -sf /opt/.venv/bin/pip /usr/local/bin/pip | ||||
| msg_ok "Installed Python Dependencies" | ||||
| 
 | ||||
| msg_info "Installing JBIG2" | ||||
| $STD curl -fsSL -o /tmp/jbig2enc.tar.gz https://github.com/agl/jbig2enc/archive/refs/tags/0.30.tar.gz | ||||
| mkdir -p /opt/jbig2enc | ||||
| tar -xzf /tmp/jbig2enc.tar.gz -C /opt/jbig2enc --strip-components=1 | ||||
| cd /opt/jbig2enc | ||||
| $STD bash ./autogen.sh | ||||
| $STD bash ./configure | ||||
| $STD make | ||||
| $STD make install | ||||
| msg_ok "Installed JBIG2" | ||||
| 
 | ||||
| msg_info "Installing Language Packs (Patience)" | ||||
| $STD apt-get install -y 'tesseract-ocr-*' | ||||
| msg_ok "Installed Language Packs" | ||||
| 
 | ||||
| msg_info "Creating Environment Variables" | ||||
| cat <<EOF >/opt/Stirling-PDF/.env | ||||
| # Java tuning | ||||
| JAVA_BASE_OPTS="-XX:+UnlockExperimentalVMOptions -XX:MaxRAMPercentage=75 -XX:InitiatingHeapOccupancyPercent=20 -XX:+G1PeriodicGCInvokesConcurrent -XX:G1PeriodicGCInterval=10000 -XX:+UseStringDeduplication -XX:G1PeriodicGCSystemLoadThreshold=70" | ||||
| JAVA_CUSTOM_OPTS="" | ||||
| 
 | ||||
| # LibreOffice | ||||
| PATH=/opt/.venv/bin:/usr/lib/libreoffice/program:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||||
| UNO_PATH=/usr/lib/libreoffice/program | ||||
| URE_BOOTSTRAP=file:///usr/lib/libreoffice/program/fundamentalrc | ||||
| PYTHONPATH=/usr/lib/libreoffice/program:/opt/.venv/lib/python3.12/site-packages | ||||
| LD_LIBRARY_PATH=/usr/lib/libreoffice/program | ||||
| 
 | ||||
| STIRLING_TEMPFILES_DIRECTORY=/tmp/stirling-pdf | ||||
| TMPDIR=/tmp/stirling-pdf | ||||
| TEMP=/tmp/stirling-pdf | ||||
| TMP=/tmp/stirling-pdf | ||||
| 
 | ||||
| # Paths | ||||
| PATH=/opt/.venv/bin:/usr/lib/libreoffice/program:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||||
| EOF | ||||
| 
 | ||||
| if [[ "$login_mode" == "true" ]]; then | ||||
|   cat <<EOF >>/opt/Stirling-PDF/.env | ||||
| # activate Login | ||||
| DISABLE_ADDITIONAL_FEATURES=false | ||||
| SECURITY_ENABLELOGIN=true | ||||
| 
 | ||||
| # login credentials | ||||
| SECURITY_INITIALLOGIN_USERNAME=admin | ||||
| SECURITY_INITIALLOGIN_PASSWORD=stirling | ||||
| EOF | ||||
| fi | ||||
| msg_ok "Created Environment Variables" | ||||
| 
 | ||||
| msg_info "Refreshing Font Cache" | ||||
| $STD fc-cache -fv | ||||
| msg_ok "Font Cache Updated" | ||||
| 
 | ||||
| msg_info "Creating Service" | ||||
| cat <<EOF >/etc/systemd/system/libreoffice-listener.service | ||||
| [Unit] | ||||
| Description=LibreOffice Headless Listener Service | ||||
| After=network.target | ||||
| 
 | ||||
| [Service] | ||||
| Type=simple | ||||
| User=root | ||||
| Group=root | ||||
| ExecStart=/usr/lib/libreoffice/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --accept="socket,host=127.0.0.1,port=2002;urp;StarOffice.ComponentContext" | ||||
| Restart=always | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| 
 | ||||
| cat <<EOF >/etc/systemd/system/stirlingpdf.service | ||||
| [Unit] | ||||
| Description=Stirling-PDF service | ||||
| After=syslog.target network.target libreoffice-listener.service | ||||
| Requires=libreoffice-listener.service | ||||
| 
 | ||||
| [Service] | ||||
| SuccessExitStatus=143 | ||||
| Type=simple | ||||
| User=root | ||||
| Group=root | ||||
| EnvironmentFile=/opt/Stirling-PDF/.env | ||||
| WorkingDirectory=/opt/Stirling-PDF | ||||
| ExecStart=/usr/bin/java -jar Stirling-PDF.jar | ||||
| ExecStop=/bin/kill -15 %n | ||||
| Restart=always | ||||
| RestartSec=10 | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| 
 | ||||
| cat <<EOF >/etc/systemd/system/unoserver.service | ||||
| [Unit] | ||||
| Description=UnoServer RPC Interface | ||||
| After=libreoffice-listener.service | ||||
| Requires=libreoffice-listener.service | ||||
| 
 | ||||
| [Service] | ||||
| Type=simple | ||||
| ExecStart=/usr/local/bin/unoserver --port 2003 --interface 127.0.0.1 | ||||
| Restart=always | ||||
| EnvironmentFile=/opt/Stirling-PDF/.env | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| 
 | ||||
| systemctl enable -q --now libreoffice-listener | ||||
| systemctl enable -q --now stirlingpdf | ||||
| systemctl enable -q --now unoserver | ||||
| msg_ok "Created Service" | ||||
| 
 | ||||
| motd_ssh | ||||
| customize | ||||
| 
 | ||||
| msg_info "Cleaning up" | ||||
| rm -f /tmp/jbig2enc.tar.gz | ||||
| $STD apt-get -y autoremove | ||||
| $STD apt-get -y autoclean | ||||
| msg_ok "Cleaned" | ||||
| @ -1,44 +0,0 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| # Copyright (c) 2021-2025 tteck | ||||
| # Author: tteck (tteckster) | ||||
| # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE | ||||
| # Source: https://github.com/TriliumNext/Trilium | ||||
| 
 | ||||
| source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" | ||||
| color | ||||
| verb_ip6 | ||||
| catch_errors | ||||
| setting_up_container | ||||
| network_check | ||||
| update_os | ||||
| 
 | ||||
| fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz" | ||||
| 
 | ||||
| msg_info "Creating Service" | ||||
| cat <<EOF >/etc/systemd/system/trilium.service | ||||
| [Unit] | ||||
| Description=Trilium Daemon | ||||
| After=syslog.target network.target | ||||
| 
 | ||||
| [Service] | ||||
| User=root | ||||
| Type=simple | ||||
| ExecStart=/opt/trilium/trilium.sh | ||||
| WorkingDirectory=/opt/trilium/ | ||||
| TimeoutStopSec=20 | ||||
| Restart=always | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
| EOF | ||||
| systemctl enable --now -q trilium | ||||
| msg_ok "Created Service" | ||||
| 
 | ||||
| motd_ssh | ||||
| customize | ||||
| 
 | ||||
| msg_info "Cleaning up" | ||||
| $STD apt-get -y autoremove | ||||
| $STD apt-get -y autoclean | ||||
| msg_ok "Cleaned" | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 CanbiZ
						CanbiZ