Update pingvin.sh and pingvin-install.sh (#1819)

This commit is contained in:
Michel Roegl-Brunner 2025-01-28 15:46:50 +01:00 committed by GitHub
parent d366d24dea
commit 97002e7047
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 31 deletions

View File

@ -32,21 +32,29 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/stonith404/pingvin-share/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/$pingvin_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/pingvin_version.txt)" ]]; then
msg_info "Stopping Pingvin Share"
systemctl stop pm2-root.service
msg_ok "Stopped Pingvin Share"
msg_info "Updating Pingvin Share"
msg_info "Updating Pingvin Share to v${RELEASE}"
cd /opt
wget -q "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
mv pingvin-share-${RELEASE} /opt/pingvin-share
cd /opt/pingvin-share
git fetch --tags
git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) &>/dev/null
cd backend
npm install &>/dev/null
npm run build &>/dev/null
cd ../frontend
npm install &>/dev/null
npm run build &>/dev/null
msg_ok "Updated Pingvin Share"
echo "${RELEASE}" >"/opt/pingvin_version.txt"
rm -rf /opt/v${RELEASE}.zip
msg_ok "Updated Pingvin Share to v${RELEASE}"
msg_info "Starting Pingvin Share"
systemctl start pm2-root.service
@ -54,8 +62,12 @@ function update_script() {
msg_ok "Updated Successfully"
exit
else
msg_ok "No update required. Pingvin Share is already at v${RELEASE}."
fi
}
start
build_container
description

View File

@ -2,6 +2,7 @@
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# Co-Author: michelroegl-brunner
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -14,11 +15,12 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
$STD apt-get install -y git
$STD apt-get install -y gnupg
$STD apt-get install -y \
curl \
sudo \
mc \
git \
gnupg
msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository"
@ -34,11 +36,14 @@ $STD npm install pm2 -g
msg_ok "Installed Node.js"
msg_info "Installing Pingvin Share (Patience)"
git clone -q https://github.com/stonith404/pingvin-share /opt/pingvin-share
cd /opt/pingvin-share
$STD git fetch --tags
$STD git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
cd backend
cd /opt
RELEASE=$(curl -s https://api.github.com/repos/stonith404/pingvin-share/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
wget -q "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
echo "${RELEASE}" >"/opt/pingvin_version.txt"
mv pingvin-share-${RELEASE} /opt/pingvin-share
cd /opt/pingvin-share/backend
$STD npm install
$STD npm run build
$STD pm2 start --name="pingvin-share-backend" npm -- run prod
@ -57,6 +62,7 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf /opt/v${RELEASE}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"