mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-25 11:11:02 +00:00
Refactor (#6424)
This commit is contained in:
@@ -27,36 +27,32 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/outline/outline/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 [[ ! -f ~/.outline ]] || [[ "${RELEASE}" != "$(cat ~/.outline)" ]]; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop outline
|
||||
msg_ok "Services Stopped"
|
||||
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
temp_file=$(mktemp)
|
||||
msg_info "Creating backup"
|
||||
cp /opt/outline/.env /opt
|
||||
rm -rf /opt/outline
|
||||
curl -fsSL "https://github.com/outline/outline/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar zxf "$temp_file"
|
||||
mv outline-"${RELEASE}" /opt/outline
|
||||
msg_ok "Backup created"
|
||||
|
||||
fetch_and_deploy_gh_release "outline" "outline/outline" "tarball"
|
||||
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
cd /opt/outline
|
||||
export NODE_ENV=development
|
||||
export NODE_OPTIONS="--max-old-space-size=3584"
|
||||
$STD yarn install --frozen-lockfile
|
||||
$STD yarn build
|
||||
mv /opt/.env /opt/outline
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start outline
|
||||
msg_ok "Started Services"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf "$temp_file"
|
||||
rm -rf "$HOME"/outline-"${RELEASE}"
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
|
Reference in New Issue
Block a user