Update bitmagnet

This commit is contained in:
tremor021 2025-05-14 19:15:40 +02:00
parent 56800199f7
commit 6a2ff4feef
2 changed files with 70 additions and 2 deletions

65
ct/bitmagnet.sh Normal file
View File

@ -0,0 +1,65 @@
#!/usr/bin/env bash
source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/bitmagnet/bitmagnet
APP="Bitmagnet"
var_tags="${var_tags:-os}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-2}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/bitmagnet ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/bitmagnet/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Service"
systemctl stop bitmagnet-web
msg_ok "Stopped Service"
msg_info "Updating ${APP} to v${RELEASE}"
temp_file=$(mktemp)
rm -rf /opt/bitmagnet/*
curl -fsSL "https://github.com/bitmagnet/bitmagnet/releases/download/v${RELEASE}/bitmagnet-v${RELEASE}-linux-amd64.zip" -o "$temp_file"
$STD unzip -j "$temp_file" '*/**' -d /opt/bitmagnet
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting Service"
systemctl start bitmagnet-web
msg_ok "Started Service"
msg_info "Cleaning up"
rm -f "$temp_file"
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

View File

@ -14,11 +14,14 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y
$STD apt-get install -y \
iproute2 \
gcc \
musl-dev
msg_ok "Installed Dependencies"
PG_VERSION=16 install_postgresql
install_go
msg_info "Installing bitmagnet"
mkdir -p /opt/bitmagnet