mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-09 23:47:38 +00:00
Refactor (#5841)
This commit is contained in:
@ -28,20 +28,16 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/excalidraw/excalidraw/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/excalidraw_version.txt)" ]] || [[ ! -f /opt/excalidraw_version.txt ]]; then
|
||||
if [[ "${RELEASE}" != "$(cat ~/.excalidraw 2>/dev/null)" ]] || [[ ! -f ~/.excalidraw ]]; then
|
||||
msg_info "Stopping $APP"
|
||||
systemctl stop excalidraw
|
||||
msg_ok "Stopped $APP"
|
||||
|
||||
msg_info "Updating $APP to v${RELEASE}"
|
||||
cd /tmp
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/excalidraw/excalidraw/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar xzf $temp_file
|
||||
rm -rf /opt/excalidraw
|
||||
mv excalidraw-${RELEASE} /opt/excalidraw
|
||||
fetch_and_deploy_gh_release "excalidraw" "excalidraw/excalidraw"
|
||||
|
||||
msg_info "Updating $APP to v${RELEASE}"
|
||||
cd /opt/excalidraw
|
||||
$STD yarn
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
@ -50,11 +46,6 @@ function update_script() {
|
||||
systemctl start excalidraw
|
||||
msg_ok "Started $APP"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf $temp_file
|
||||
msg_ok "Cleanup Completed"
|
||||
|
||||
echo "${RELEASE}" >/opt/excalidraw_version.txt
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
|
@ -14,21 +14,15 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
xdg-utils
|
||||
$STD apt-get install -y xdg-utils
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs
|
||||
fetch_and_deploy_gh_release "excalidraw" "excalidraw/excalidraw"
|
||||
|
||||
msg_info "Setup Excalidraw"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/excalidraw/excalidraw/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/excalidraw/excalidraw/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar xzf $temp_file
|
||||
mv excalidraw-${RELEASE} /opt/excalidraw
|
||||
msg_info "Configuring Excalidraw"
|
||||
cd /opt/excalidraw
|
||||
$STD yarn
|
||||
echo "${RELEASE}" >/opt/excalidraw_version.txt
|
||||
msg_ok "Setup Excalidraw"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@ -53,7 +47,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f $temp_file
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Reference in New Issue
Block a user