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
+10 -13
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
}