This commit is contained in:
Slaviša Arežina 2025-07-31 13:58:48 +02:00 committed by GitHub
parent dd2defebaf
commit 9e9bff2315
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 19 deletions

View File

@ -28,31 +28,28 @@ function update_script() {
exit
fi
RELEASE=$(curl -fsSL https://github.com/gnmyt/myspeed/releases/latest | grep "title>Release" | cut -d " " -f 5)
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
if [[ ! -f ~/.myspeed ]] || [[ "${RELEASE}" != "$(cat ~/.myspeed)" ]]; then
msg_info "Stopping ${APP} Service"
systemctl stop myspeed
msg_ok "Stopped ${APP} Service"
msg_info "Updating ${APP} to ${RELEASE}"
msg_info "Creating backup"
cd /opt
rm -rf myspeed_bak
mv myspeed myspeed_bak
curl -fsSL "https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip" -o $(basename "https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip")
$STD unzip MySpeed-$RELEASE.zip -d myspeed
cd myspeed
msg_ok "Backup created"
fetch_and_deploy_gh_release "myspeed" "gnmyt/myspeed" "prebuild" "latest" "/opt/myspeed" "MySpeed-*.zip"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/myspeed
$STD npm install
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP} Service"
systemctl start myspeed
msg_ok "Started ${APP} Service"
msg_info "Cleaning up"
rm -rf MySpeed-$RELEASE.zip
msg_ok "Cleaned"
msg_ok "Updated Successfully!\n"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"

View File

@ -20,15 +20,11 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies"
NODE_VERSION="22" setup_nodejs
fetch_and_deploy_gh_release "myspeed" "gnmyt/myspeed" "prebuild" "latest" "/opt/myspeed" "MySpeed-*.zip"
msg_info "Installing MySpeed"
RELEASE=$(curl -fsSL https://github.com/gnmyt/myspeed/releases/latest | grep "title>Release" | cut -d " " -f 5)
cd /opt
curl -fsSL "https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip" -o "MySpeed-$RELEASE.zip"
$STD unzip MySpeed-$RELEASE.zip -d myspeed
cd myspeed
msg_info "Configuring MySpeed"
cd /opt/myspeed
$STD npm install
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed MySpeed"
msg_info "Creating Service"
@ -56,6 +52,5 @@ customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
rm -rf /opt/MySpeed-$RELEASE.zip
$STD apt-get -y autoclean
msg_ok "Cleaned"