This commit is contained in:
Slaviša Arežina
2025-12-24 15:28:56 +01:00
committed by GitHub
parent c074d3f567
commit 23e3be00f0
2 changed files with 18 additions and 28 deletions

View File

@ -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
}

View File

@ -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