cleanup
This commit is contained in:
parent
d0c0fd2a72
commit
583f137424
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL 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/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/bitmagnet-io/bitmagnet
|
||||
|
||||
APP="Alpine-bitmagnet"
|
||||
var_tags="${var_tags:-alpine;torrent}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-256}"
|
||||
var_disk="${var_disk:-3}"
|
||||
var_os="${var_os:-alpine}"
|
||||
var_version="${var_version:-3.21}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
|
||||
if [[ ! -d /opt/bitmagnet ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit 1
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [ "${RELEASE}" != "$(cat /opt/bitmagnet_version.txt)" ] || [ ! -f /opt/bitmagnet_version.txt ]; then
|
||||
msg_info "Backing up database"
|
||||
rm -f /tmp/backup.sql
|
||||
$STD sudo -u postgres pg_dump \
|
||||
--column-inserts \
|
||||
--data-only \
|
||||
--on-conflict-do-nothing \
|
||||
--rows-per-insert=1000 \
|
||||
--table=metadata_sources \
|
||||
--table=content \
|
||||
--table=content_attributes \
|
||||
--table=content_collections \
|
||||
--table=content_collections_content \
|
||||
--table=torrent_sources \
|
||||
--table=torrents \
|
||||
--table=torrent_files \
|
||||
--table=torrent_hints \
|
||||
--table=torrent_contents \
|
||||
--table=torrent_tags \
|
||||
--table=torrents_torrent_sources \
|
||||
--table=key_values \
|
||||
bitmagnet \
|
||||
>/tmp/backup.sql
|
||||
mv /tmp/backup.sql /opt/
|
||||
msg_ok "Database backed up"
|
||||
|
||||
msg_info "Updating ${APP} from $(cat /opt/bitmagnet_version.txt) to ${RELEASE}"
|
||||
$STD apk -U upgrade
|
||||
$STD service bitmagnet stop
|
||||
[ -f /opt/bitmagnet/.env ] && cp /opt/bitmagnet/.env /opt/
|
||||
[ -f /opt/bitmagnet/config.yml ] && cp /opt/bitmagnet/config.yml /opt/
|
||||
rm -rf /opt/bitmagnet/*
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet
|
||||
cd /opt/bitmagnet
|
||||
VREL=v$RELEASE
|
||||
$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/
|
||||
rm -f "$temp_file"
|
||||
echo "${RELEASE}" >/opt/bitmagnet_version.txt
|
||||
$STD service bitmagnet start
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
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 IP:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3333${CL}"
|
@ -1,98 +0,0 @@
|
||||
#!/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:-4}"
|
||||
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-io/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 "Backing up database"
|
||||
rm -f /tmp/backup.sql
|
||||
$STD sudo -u postgres pg_dump \
|
||||
--column-inserts \
|
||||
--data-only \
|
||||
--on-conflict-do-nothing \
|
||||
--rows-per-insert=1000 \
|
||||
--table=metadata_sources \
|
||||
--table=content \
|
||||
--table=content_attributes \
|
||||
--table=content_collections \
|
||||
--table=content_collections_content \
|
||||
--table=torrent_sources \
|
||||
--table=torrents \
|
||||
--table=torrent_files \
|
||||
--table=torrent_hints \
|
||||
--table=torrent_contents \
|
||||
--table=torrent_tags \
|
||||
--table=torrents_torrent_sources \
|
||||
--table=key_values \
|
||||
bitmagnet \
|
||||
>/tmp/backup.sql
|
||||
mv /tmp/backup.sql /opt/
|
||||
msg_ok "Database backed up"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
[ -f /opt/bitmagnet/.env ] && cp /opt/bitmagnet/.env /opt/
|
||||
[ -f /opt/bitmagnet/config.yml ] && cp /opt/bitmagnet/config.yml /opt/
|
||||
rm -rf /opt/bitmagnet/*
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet
|
||||
cd /opt/bitmagnet
|
||||
VREL=v$RELEASE
|
||||
$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/
|
||||
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}:3333${CL}"
|
65
ct/rclone.sh
65
ct/rclone.sh
@ -1,65 +0,0 @@
|
||||
#!/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/rclone/rclone
|
||||
|
||||
APP="Rclone"
|
||||
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/rclone ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/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 rclone-web
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
temp_file=$(mktemp)
|
||||
rm -rf /opt/rclone/*
|
||||
curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-amd64.zip" -o "$temp_file"
|
||||
$STD unzip -j "$temp_file" '*/**' -d /opt/rclone
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start rclone-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}"
|
@ -1,85 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/bitmagnet-io/bitmagnet
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing dependencies"
|
||||
$STD apk add --no-cache \
|
||||
gcc \
|
||||
musl-dev \
|
||||
git \
|
||||
iproute2-ss \
|
||||
sudo
|
||||
$STD apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community go
|
||||
msg_ok "Installed dependencies"
|
||||
|
||||
msg_info "Installing PostgreSQL"
|
||||
$STD apk add --no-cache \
|
||||
postgresql16 \
|
||||
postgresql16-contrib \
|
||||
postgresql16-openrc
|
||||
$STD rc-update add postgresql
|
||||
$STD rc-service postgresql start
|
||||
msg_ok "Installed PostreSQL"
|
||||
|
||||
RELEASE=$(curl -s https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
|
||||
msg_info "Installing bitmagnet v${RELEASE}"
|
||||
mkdir -p /opt/bitmagnet
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet
|
||||
cd /opt/bitmagnet
|
||||
VREL=v$RELEASE
|
||||
$STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=$VREL"
|
||||
chmod +x bitmagnet
|
||||
$STD su - postgres -c "psql -c 'CREATE DATABASE bitmagnet;'"
|
||||
echo "${RELEASE}" >/opt/bitmagnet_version.txt
|
||||
msg_ok "Installed bitmagnet v${RELEASE}"
|
||||
|
||||
read -rp "${TAB3}Enter your TMDB API key if you have one: " tmdbapikey
|
||||
|
||||
msg_info "Enabling bitmagnet Service"
|
||||
cat <<EOF >/etc/init.d/bitmagnet
|
||||
#!/sbin/openrc-run
|
||||
description="bitmagnet Service"
|
||||
directory="/opt/bitmagnet"
|
||||
command="/opt/bitmagnet/bitmagnet"
|
||||
command_args="worker run --all"
|
||||
command_background="true"
|
||||
command_user="root"
|
||||
pidfile="/var/run/bitmagnet.pid"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
export TMDB_API_KEY="$tmdbapikey"
|
||||
}
|
||||
EOF
|
||||
chmod +x /etc/init.d/bitmagnet
|
||||
$STD rc-update add bitmagnet default
|
||||
msg_ok "Enabled bitmagnet Service"
|
||||
|
||||
msg_info "Starting bitmagnet"
|
||||
$STD service bitmagnet start
|
||||
msg_ok "Started bitmagnet"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
$STD apk cache clean
|
||||
msg_ok "Cleaned"
|
@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/bitmagnet-io/bitmagnet
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
iproute2 \
|
||||
gcc \
|
||||
musl-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="16" install_postgresql
|
||||
install_go
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
|
||||
msg_info "Installing bitmagnet v${RELEASE}"
|
||||
mkdir -p /opt/bitmagnet
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||
tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet
|
||||
cd /opt/bitmagnet
|
||||
VREL=v$RELEASE
|
||||
$STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=$VREL"
|
||||
chmod +x bitmagnet
|
||||
POSTGRES_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$POSTGRES_PASSWORD';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE bitmagnet;"
|
||||
{
|
||||
echo "PostgreSQL Credentials"
|
||||
echo ""
|
||||
echo "postgres user password: $POSTGRES_PASSWORD"
|
||||
} >>~/postgres.creds
|
||||
echo "${RELEASE}" >/opt/bitmagnet_version.txt
|
||||
msg_ok "Installed bitmagnet v${RELEASE}"
|
||||
|
||||
read -r -p "${TAB3}Enter your TMDB API key if you have one: " tmdbapikey
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/bitmagnet-web.service
|
||||
[Unit]
|
||||
Description=bitmagnet Web GUI
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/bitmagnet
|
||||
ExecStart=/opt/bitmagnet/bitmagnet worker run --all
|
||||
Environment=POSTGRES_HOST=localhost
|
||||
Environment=POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||
Environment=TMDB_API_KEY=$tmdbapikey
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now bitmagnet-web
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
@ -17,12 +17,10 @@ update_os
|
||||
# Installing Dependencies
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
gnupg \
|
||||
apt-transport-https \
|
||||
software-properties-common \
|
||||
lsb-base \
|
||||
lsb-release \
|
||||
gnupg2 \
|
||||
python3 \
|
||||
python3-requests \
|
||||
python3-dotenv
|
||||
|
@ -15,7 +15,6 @@ update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
tar \
|
||||
iptables
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
@ -24,7 +23,7 @@ cd /opt
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/jumpserver/installer/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
|
||||
curl -fsSL "https://github.com/jumpserver/installer/releases/download/${RELEASE}/jumpserver-installer-${RELEASE}.tar.gz" -o jumpserver-installer-${RELEASE}.tar.gz
|
||||
mkdir -p /opt/jumpserver
|
||||
$STD tar -xzvf jumpserver-installer-${RELEASE}.tar.gz -C /opt/jumpserver --strip-components=1
|
||||
tar -xzvf jumpserver-installer-${RELEASE}.tar.gz -C /opt/jumpserver --strip-components=1
|
||||
cd /opt/jumpserver
|
||||
$STD ./jmsctl.sh install <<EOF
|
||||
n
|
||||
|
Loading…
x
Reference in New Issue
Block a user