Skip to content

Commit 97002e7

Browse files
Update pingvin.sh and pingvin-install.sh (#1819)
1 parent d366d24 commit 97002e7

File tree

2 files changed

+49
-31
lines changed

2 files changed

+49
-31
lines changed

ct/pingvin.sh

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,47 @@ function update_script() {
3232
msg_error "No ${APP} Installation Found!"
3333
exit
3434
fi
35-
msg_info "Stopping Pingvin Share"
36-
systemctl stop pm2-root.service
37-
msg_ok "Stopped Pingvin Share"
35+
36+
RELEASE=$(curl -s https://api.github.com/repos/stonith404/pingvin-share/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
37+
if [[ ! -f /opt/$pingvin_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/pingvin_version.txt)" ]]; then
38+
39+
msg_info "Stopping Pingvin Share"
40+
systemctl stop pm2-root.service
41+
msg_ok "Stopped Pingvin Share"
42+
43+
msg_info "Updating Pingvin Share to v${RELEASE}"
44+
cd /opt
45+
wget -q "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip"
46+
unzip -q v${RELEASE}.zip
47+
mv pingvin-share-${RELEASE} /opt/pingvin-share
48+
cd /opt/pingvin-share
49+
cd backend
50+
npm install &>/dev/null
51+
npm run build &>/dev/null
52+
cd ../frontend
53+
npm install &>/dev/null
54+
npm run build &>/dev/null
55+
echo "${RELEASE}" >"/opt/pingvin_version.txt"
56+
rm -rf /opt/v${RELEASE}.zip
57+
msg_ok "Updated Pingvin Share to v${RELEASE}"
3858

39-
msg_info "Updating Pingvin Share"
40-
cd /opt/pingvin-share
41-
git fetch --tags
42-
git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) &>/dev/null
43-
cd backend
44-
npm install &>/dev/null
45-
npm run build &>/dev/null
46-
cd ../frontend
47-
npm install &>/dev/null
48-
npm run build &>/dev/null
49-
msg_ok "Updated Pingvin Share"
59+
msg_info "Starting Pingvin Share"
60+
systemctl start pm2-root.service
61+
msg_ok "Started Pingvin Share"
5062

51-
msg_info "Starting Pingvin Share"
52-
systemctl start pm2-root.service
53-
msg_ok "Started Pingvin Share"
54-
55-
msg_ok "Updated Successfully"
56-
exit
63+
msg_ok "Updated Successfully"
64+
exit
65+
else
66+
msg_ok "No update required. Pingvin Share is already at v${RELEASE}."
67+
fi
5768
}
5869

70+
5971
start
6072
build_container
6173
description
6274

6375
msg_ok "Completed Successfully!\n"
6476
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
6577
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
66-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
78+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

install/pingvin-install.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Copyright (c) 2021-2025 tteck
44
# Author: tteck (tteckster)
5+
# Co-Author: michelroegl-brunner
56
# License: MIT
67
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
78

@@ -14,11 +15,12 @@ network_check
1415
update_os
1516

1617
msg_info "Installing Dependencies"
17-
$STD apt-get install -y curl
18-
$STD apt-get install -y sudo
19-
$STD apt-get install -y mc
20-
$STD apt-get install -y git
21-
$STD apt-get install -y gnupg
18+
$STD apt-get install -y \
19+
curl \
20+
sudo \
21+
mc \
22+
git \
23+
gnupg
2224
msg_ok "Installed Dependencies"
2325

2426
msg_info "Setting up Node.js Repository"
@@ -34,11 +36,14 @@ $STD npm install pm2 -g
3436
msg_ok "Installed Node.js"
3537

3638
msg_info "Installing Pingvin Share (Patience)"
37-
git clone -q https://github.com/stonith404/pingvin-share /opt/pingvin-share
38-
cd /opt/pingvin-share
39-
$STD git fetch --tags
40-
$STD git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
41-
cd backend
39+
cd /opt
40+
RELEASE=$(curl -s https://api.github.com/repos/stonith404/pingvin-share/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
41+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
42+
wget -q "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip"
43+
unzip -q v${RELEASE}.zip
44+
echo "${RELEASE}" >"/opt/pingvin_version.txt"
45+
mv pingvin-share-${RELEASE} /opt/pingvin-share
46+
cd /opt/pingvin-share/backend
4247
$STD npm install
4348
$STD npm run build
4449
$STD pm2 start --name="pingvin-share-backend" npm -- run prod
@@ -57,6 +62,7 @@ motd_ssh
5762
customize
5863

5964
msg_info "Cleaning up"
65+
rm -rf /opt/v${RELEASE}.zip
6066
$STD apt-get -y autoremove
6167
$STD apt-get -y autoclean
6268
msg_ok "Cleaned"

0 commit comments

Comments
 (0)