diff --git a/ct/paperless-gpt.sh b/ct/paperless-gpt.sh index 95c23820a..74e2ea38e 100644 --- a/ct/paperless-gpt.sh +++ b/ct/paperless-gpt.sh @@ -27,18 +27,19 @@ function update_script() { msg_error "No Paperless-GPT installation found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/icereed/paperless-gpt/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + if check_for_gh_release "paperless-gpt" "icereed/paperless-gpt"; then msg_info "Stopping Service" systemctl stop paperless-gpt msg_ok "Service Stopped" - msg_info "Updating Paperless-GPT to ${RELEASE}" - temp_file=$(mktemp) - curl -fsSL "https://github.com/icereed/paperless-gpt/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" - tar zxf $temp_file - rm -rf /opt/paperless-gpt - mv paperless-gpt-${RELEASE} /opt/paperless-gpt + if should_update_tool "node" "24"; then + NODE_VERSION="24" setup_nodejs + fi + + fetch_and_deploy_gh_release "paperless-gpt" "icereed/paperless-gpt" "tarball" + + msg_info "Updating Paperless-GPT" cd /opt/paperless-gpt/web-app $STD npm install $STD npm run build @@ -47,16 +48,12 @@ function update_script() { export CC=musl-gcc CGO_ENABLED=1 go build -tags musl -o /dev/null github.com/mattn/go-sqlite3 CGO_ENABLED=1 go build -tags musl -o paperless-gpt . - rm -f $temp_file - echo "${RELEASE}" >"/opt/paperless-gpt_version.txt" - msg_ok "Updated Paperless-GPT to ${RELEASE}" + msg_ok "Updated Paperless-GPT" msg_info "Starting Service" systemctl start paperless-gpt msg_ok "Started Service" msg_ok "Updated successfully!" - else - msg_ok "No update required. ${APP} is already at ${RELEASE}" fi exit } diff --git a/install/paperless-gpt-install.sh b/install/paperless-gpt-install.sh index 55dccecd3..9de459925 100644 --- a/install/paperless-gpt-install.sh +++ b/install/paperless-gpt-install.sh @@ -16,22 +16,17 @@ update_os msg_info "Installing Dependencies" $STD apt install -y \ gcc \ - ca-certificates \ musl-dev \ mupdf \ libc6-dev \ musl-tools msg_ok "Installed Dependencies" -NODE_VERSION="22" setup_nodejs +NODE_VERSION="24" setup_nodejs setup_go +fetch_and_deploy_gh_release "paperless-gpt" "icereed/paperless-gpt" "tarball" msg_info "Setup Paperless-GPT" -temp_file=$(mktemp) -RELEASE=$(curl -fsSL https://api.github.com/repos/icereed/paperless-gpt/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/icereed/paperless-gpt/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" -tar zxf "$temp_file" -mv paperless-gpt-"${RELEASE}" /opt/paperless-gpt cd /opt/paperless-gpt/web-app $STD npm install $STD npm run build @@ -40,21 +35,19 @@ go mod download export CC=musl-gcc CGO_ENABLED=1 go build -tags musl -o /dev/null github.com/mattn/go-sqlite3 CGO_ENABLED=1 go build -tags musl -o paperless-gpt . -rm -f "$temp_file" -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Setup Paperless-GPT" mkdir -p /opt/paperless-gpt-data -read -p "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url -if [[ "$input_url" =~ ^[Yy]$ ]]; then - read -p "${TAB3}Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL +read -rp "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url +if [[ $input_url =~ ^[Yy]$ ]]; then + read -rp "${TAB3}Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL else PAPERLESS_BASE_URL="http://your_paperless_ngx_url" fi -read -p "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token -if [[ "$input_token" =~ ^[Yy]$ ]]; then - read -p "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN +read -rp "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token +if [[ $input_token =~ ^[Yy]$ ]]; then + read -rp "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN else PAPERLESS_API_TOKEN="your_paperless_api_token" fi