mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-18 16:32:17 +00:00
Refactor (#10274)
This commit is contained in:
@@ -27,18 +27,19 @@ function update_script() {
|
|||||||
msg_error "No Paperless-GPT installation found!"
|
msg_error "No Paperless-GPT installation found!"
|
||||||
exit
|
exit
|
||||||
fi
|
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"
|
msg_info "Stopping Service"
|
||||||
systemctl stop paperless-gpt
|
systemctl stop paperless-gpt
|
||||||
msg_ok "Service Stopped"
|
msg_ok "Service Stopped"
|
||||||
|
|
||||||
msg_info "Updating Paperless-GPT to ${RELEASE}"
|
if should_update_tool "node" "24"; then
|
||||||
temp_file=$(mktemp)
|
NODE_VERSION="24" setup_nodejs
|
||||||
curl -fsSL "https://github.com/icereed/paperless-gpt/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
fi
|
||||||
tar zxf $temp_file
|
|
||||||
rm -rf /opt/paperless-gpt
|
fetch_and_deploy_gh_release "paperless-gpt" "icereed/paperless-gpt" "tarball"
|
||||||
mv paperless-gpt-${RELEASE} /opt/paperless-gpt
|
|
||||||
|
msg_info "Updating Paperless-GPT"
|
||||||
cd /opt/paperless-gpt/web-app
|
cd /opt/paperless-gpt/web-app
|
||||||
$STD npm install
|
$STD npm install
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
@@ -47,16 +48,12 @@ function update_script() {
|
|||||||
export CC=musl-gcc
|
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 /dev/null github.com/mattn/go-sqlite3
|
||||||
CGO_ENABLED=1 go build -tags musl -o paperless-gpt .
|
CGO_ENABLED=1 go build -tags musl -o paperless-gpt .
|
||||||
rm -f $temp_file
|
msg_ok "Updated Paperless-GPT"
|
||||||
echo "${RELEASE}" >"/opt/paperless-gpt_version.txt"
|
|
||||||
msg_ok "Updated Paperless-GPT to ${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start paperless-gpt
|
systemctl start paperless-gpt
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,22 +16,17 @@ update_os
|
|||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
gcc \
|
gcc \
|
||||||
ca-certificates \
|
|
||||||
musl-dev \
|
musl-dev \
|
||||||
mupdf \
|
mupdf \
|
||||||
libc6-dev \
|
libc6-dev \
|
||||||
musl-tools
|
musl-tools
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
NODE_VERSION="22" setup_nodejs
|
NODE_VERSION="24" setup_nodejs
|
||||||
setup_go
|
setup_go
|
||||||
|
fetch_and_deploy_gh_release "paperless-gpt" "icereed/paperless-gpt" "tarball"
|
||||||
|
|
||||||
msg_info "Setup Paperless-GPT"
|
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
|
cd /opt/paperless-gpt/web-app
|
||||||
$STD npm install
|
$STD npm install
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
@@ -40,21 +35,19 @@ go mod download
|
|||||||
export CC=musl-gcc
|
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 /dev/null github.com/mattn/go-sqlite3
|
||||||
CGO_ENABLED=1 go build -tags musl -o paperless-gpt .
|
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"
|
msg_ok "Setup Paperless-GPT"
|
||||||
|
|
||||||
mkdir -p /opt/paperless-gpt-data
|
mkdir -p /opt/paperless-gpt-data
|
||||||
read -p "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url
|
read -rp "${TAB3}Do you want to enter the Paperless local URL now? (y/n) " input_url
|
||||||
if [[ "$input_url" =~ ^[Yy]$ ]]; then
|
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}Enter your Paperless-NGX instance URL (e.g., http://192.168.1.100:8000): " PAPERLESS_BASE_URL
|
||||||
else
|
else
|
||||||
PAPERLESS_BASE_URL="http://your_paperless_ngx_url"
|
PAPERLESS_BASE_URL="http://your_paperless_ngx_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token
|
read -rp "${TAB3}Do you want to enter the Paperless API token now? (y/n) " input_token
|
||||||
if [[ "$input_token" =~ ^[Yy]$ ]]; then
|
if [[ $input_token =~ ^[Yy]$ ]]; then
|
||||||
read -p "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN
|
read -rp "${TAB3}Enter your Paperless API token: " PAPERLESS_API_TOKEN
|
||||||
else
|
else
|
||||||
PAPERLESS_API_TOKEN="your_paperless_api_token"
|
PAPERLESS_API_TOKEN="your_paperless_api_token"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user