Refactor A-B (#15075)

This commit is contained in:
Slaviša Arežina
2026-06-13 18:43:15 +02:00
committed by GitHub
parent 07ab5dc16e
commit d4b9bc86e8
17 changed files with 93 additions and 173 deletions
+6 -8
View File
@@ -56,21 +56,19 @@ function update_script() {
bitmagnet \
>/tmp/backup.sql
mv /tmp/backup.sql /opt/
[ -f /opt/bitmagnet/.env ] && cp /opt/bitmagnet/.env /opt/
[ -f /opt/bitmagnet/config.yml ] && cp /opt/bitmagnet/config.yml /opt/
create_backup /opt/bitmagnet/.env \
/opt/bitmagnet/config.yml
msg_ok "Data backed up"
rm -rf /opt/bitmagnet
fetch_and_deploy_gh_release "bitmagnet" "bitmagnet-io/bitmagnet" "tarball"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bitmagnet" "bitmagnet-io/bitmagnet" "tarball"
restore_backup
msg_info "Updating Bitmagnet"
msg_info "Configuring Bitmagnet"
cd /opt/bitmagnet
VREL=v$(curl -fsSL https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
$STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=$VREL"
chmod +x bitmagnet
[ -f "/opt/.env" ] && cp "/opt/.env" /opt/bitmagnet/
[ -f "/opt/config.yml" ] && cp "/opt/config.yml" /opt/bitmagnet/
msg_ok "Updated Bitmagnet"
msg_ok "Configured Bitmagnet"
msg_info "Starting Service"
systemctl start bitmagnet-web