+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .config/binaries/installGameBinaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash

# File: installGameBinaries.sh
# Description: Script to install game binaries for the Plutonium Call of Duty: Black Ops Server
# Version: 1.0.0
# Author: Sterbweise
# Last Updated: 12/12/2024

# Import global configurations
if [ "$1" = "--install" ]; then
source /opt/T5Server/.config/config.sh
fi

# Function to install game binaries
installGameBinaries () {
{
# Create directory structure for Plutonium
mkdir -p "$WORKDIR/Plutonium/storage/t5/"{gamesettings,scripts,mods}

# Clone T5ServerConfigs repository
rm -rf /tmp/T5ServerConfigs
checkAndInstallCommand "git" "git"
git clone https://github.com/xerxes-at/T5ServerConfig.git /tmp/T5ServerConfigs

# Install rsync if not present
checkAndInstallCommand "rsync" "rsync"

# Copy configuration files
if [ -d "/tmp/T5ServerConfigs/localappdata/Plutonium/storage/t5" ]; then
mkdir -p "$WORKDIR/Plutonium/storage/t5"
rsync -a --delete "/tmp/T5ServerConfigs/localappdata/Plutonium/storage/t5/" "$WORKDIR/Plutonium/storage/t5"
fi

# Clean up T5ServerConfigs
rm -rf /tmp/T5ServerConfigs

# Download required files from torrent
checkAndInstallCommand "aria2c" "aria2"
# Clean up any existing pluto_t5_full_game files/directories in /tmp
rm -rf /tmp/pluto_t5_full_game*
aria2c --dir=/tmp --seed-time=0 --console-log-level=error --summary-interval=1 --select-file=$(aria2c -S "$WORKDIR/Resources/sources/pluto_t5_full_game.torrent" | grep -E "main/|zone/|binkw32.dll|localization.txt" | cut -d'|' -f1 | tr '\n' ',' | tr -d ' ') "$WORKDIR/Resources/sources/pluto_t5_full_game.torrent"

# Move downloaded files to Resources
rsync -a "/tmp/pluto_t5_full_game/main" "$WORKDIR/Server/"
rsync -a "/tmp/pluto_t5_full_game/zone" "$WORKDIR/Server/"
rsync -a "/tmp/pluto_t5_full_game/binkw32.dll" "$WORKDIR/Server/binkw32.dll"
rsync -a "/tmp/pluto_t5_full_game/localization.txt" "$WORKDIR/Server/localization.txt"

# Clean up downloaded files
rm -rf /tmp/pluto_t5_full_game

# Setup Plutonium updater
if [ ! -f "$WORKDIR/Plutonium/plutonium-updater" ]; then
cd "$WORKDIR/Plutonium/" || exit
checkAndInstallCommand "wget" "wget"
wget -q -O plutonium-updater.tar.gz https://github.com/mxve/plutonium-updater.rs/releases/latest/download/plutonium-updater-x86_64-unknown-linux-gnu.tar.gz
checkAndInstallCommand "tar" "tar"
tar xf plutonium-updater.tar.gz plutonium-updater
rm plutonium-updater.tar.gz
chmod +x plutonium-updater
fi

# Make T5Server.sh executable
chmod +x "$WORKDIR/Plutonium/T5Server.sh"
} > /dev/null 2>&1 &
showProgressIndicator "$(getMessage "binary")"

# Verify installation
if [ ! -f "$WORKDIR/Plutonium/plutonium-updater" ]; then
printf "${COLORS[RED]}Error:${COLORS[RESET]} Game binaries installation failed.\n"
printf "You can try running the installation script separately by executing:\n"
printf "cd .config/binaries && ./installGameBinaries.sh\n"
fi
}

# Run the installation function if --install is provided
if [ "$1" = "--import" ]; then
:
elif [ "$1" = "--install" ]; then
installGameBinaries
else
echo "Usage: $0 [--install] | [--import]"
echo "This script installs game binaries. Use --install or no argument to proceed with installation."
fi
55 changes: 55 additions & 0 deletions .config/binaries/uninstallGameBinaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# File: uninstallGameBinaries.sh
# Description: Script to uninstall game binaries for the Plutonium Call of Duty: Black Ops Server
# Version: 1.0.0
# Author: Sterbweise
# Last Updated: 12/12/2024

# Import global configurations
if [ "$1" = "--uninstall" ]; then
source /opt/T5Server/.config/config.sh
fi

# Function to uninstall game binaries
uninstallGameBinaries () {
{
# Remove the main game directories
rm -rf "$WORKDIR/Server"

# Remove the Plutonium directory
rm -rf "$WORKDIR/Plutonium"

# Remove the Resources directory if it exists
if [ -d "$WORKDIR/Resources" ]; then
rm -rf "$WORKDIR/Resources"
fi

# Remove the entire WORKDIR if it's empty
if [ -z "$(ls -A "$WORKDIR")" ]; then
rm -rf "$WORKDIR"
fi

} > /dev/null 2>&1 &
showProgressIndicator "$(getMessage "uninstall_binary")"

# Verify uninstallation
if [ ! -d "$WORKDIR/Server" ] && [ ! -d "$WORKDIR/Plutonium" ]; then
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Game binaries have been uninstalled.\n"
else
printf "${COLORS[RED]}Error:${COLORS[RESET]} Game binaries uninstallation may have failed.\n"
printf "You can try manually removing the directories:\n"
printf "$WORKDIR/Server\n"
printf "$WORKDIR/Plutonium\n"
fi
}

# Run the uninstallation function if --uninstall is provided
if [ "$1" = "--import" ]; then
:
elif [ "$1" = "--uninstall" ]; then
uninstallGameBinaries
else
echo "Usage: $0 [--uninstall] | [--import]"
echo "This script uninstalls game binaries. Use --uninstall or no argument to proceed with uninstallation."
fi
59 changes: 59 additions & 0 deletions .config/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# config.sh - Configuration file for Plutonium Call of Duty: Black Ops Server
# Version: 1.0.0
# Author: Sterbweise
# Last Updated: 12/12/2024

# Description:
# This script defines global variables and configurations used across the server installation
# and management scripts. It includes settings for work directories, distribution detection,
# color codes for output formatting, and language preferences.

# Usage:
# This file is sourced by other scripts and should not be executed directly.

# Note: Modify the variables in this file to customize your server setup.

# Set default language and locale settings
# These ensure consistent character encoding and language behavior across the system
export LANG=C.UTF-8
export LC_ALL=C.UTF-8

# Work directory
# This is the base directory where the server files will be installed
WORKDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)"

# Distribution detection
# Automatically detects the Linux distribution and version
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$ID
VERSION=$VERSION_ID
else
# Default to Debian 10 if detection fails
DISTRO="debian"
VERSION="10"
fi

# Color codes for terminal output
# Import color definitions from utility/colors.sh
source "$(dirname "${BASH_SOURCE[0]}")/utility/colors.sh"


# Global variables
# These variables are used across different scripts for configuration
language=0 # Default language setting (0 for English)
firewall="" # Firewall configuration (empty string for default behavior)
ssh_port=22 # Default SSH port
dotnet="" # .NET installation flag (empty string for default behavior)

# Function to check and install required commands
checkAndInstallCommand() {
local command=$1
local package=$2
if ! command -v "$command" &> /dev/null; then
printf "Installing %s...\n" "$package"
apt-get install -y "$package" > /dev/null 2>&1
fi
}
67 changes: 67 additions & 0 deletions .config/dependencies/installDependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

# File: installDependencies.sh
# Description: Script to install dependencies for the Plutonium Call of Duty: Black Ops Server
# Version: 1.0.0
# Author: Sterbweise
# Last Updated: 12/12/2024

# Import global configurations
if [ "$1" = "--install" ]; then
source /opt/T5Server/.config/config.sh
fi

# Function to install dependencies
installDependencies() {
{
apt-get update
# Install system utilities
apt-get install -y \
sudo \
aria2 \
tar \
wget \
gnupg2 \
software-properties-common \
apt-transport-https \
curl \
rsync \
procps

# Install required libraries
apt-get install -y \
libssl1.1 \
libcurl4 \
libc6:i386 \
libstdc++6:i386

} > /dev/null 2>&1 &
showProgressIndicator "$(getMessage "dependencies_install")"

# Verify installation
if ! command -v wget &> /dev/null || ! command -v gpg &> /dev/null || ! command -v curl &> /dev/null || ! dpkg -s software-properties-common &> /dev/null || ! dpkg -s apt-transport-https &> /dev/null
then
printf "${COLORS[RED]}Error:${COLORS[RESET]} Dependencies installation failed.\n"
printf "Attempting reinstallation...\n"
apt-get install -y sudo wget gnupg2 software-properties-common apt-transport-https curl
if ! command -v wget &> /dev/null || ! command -v gpg &> /dev/null || ! command -v curl &> /dev/null || ! dpkg -s software-properties-common &> /dev/null || ! dpkg -s apt-transport-https &> /dev/null
then
printf "${COLORS[RED]}Error:${COLORS[RESET]} Reinstallation failed. Please check your internet connection and try again.\n"
exit 1
fi
fi

if [ "$1" = "--install" ]; then
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been installed.\n"
fi
}

# Run the installation function if --install is provided
if [ "$1" = "--import" ]; then
:
elif [ "$1" = "--install" ]; then
installDependencies
else
echo "Usage: $0 [--install] | [--import]"
echo "This script installs dependencies. Use --install or no argument to proceed with installation."
fi
50 changes: 50 additions & 0 deletions .config/dependencies/uninstallDependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# File: uninstallDependencies.sh
# Description: Script to uninstall dependencies for the Plutonium Call of Duty: Black Ops Server
# Version: 1.0.0
# Author: Sterbweise
# Last Updated: 12/12/2024

# Import global configurations
if [ "$1" = "--uninstall" ]; then
source /opt/T5Server/.config/config.sh
fi

# Function to uninstall dependencies
uninstallDependencies() {
{
apt-get remove -y software-properties-common apt-transport-https
apt-get autoremove -y
} > /dev/null 2>&1 &
showProgressIndicator "$(getMessage "cleanup")"

# Verify uninstallation
if dpkg -s software-properties-common &> /dev/null || dpkg -s apt-transport-https &> /dev/null
then
printf "${COLORS[RED]}Error:${COLORS[RESET]} Dependencies uninstallation failed.\n"
printf "Attempting manual removal...\n"
apt-get remove -y software-properties-common apt-transport-https
apt-get autoremove -y
if dpkg -s software-properties-common &> /dev/null || dpkg -s apt-transport-https &> /dev/null
then
printf "${COLORS[RED]}Error:${COLORS[RESET]} Manual removal failed. Some dependencies may still be present.\n"
else
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been manually removed.\n"
fi
else
if [ "$1" = "--uninstall" ]; then
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been uninstalled.\n"
fi
fi
}

# Run the uninstallation function if --uninstall is provided
if [ "$1" = "--import" ]; then
:
elif [ "$1" = "--uninstall" ]; then
uninstallDependencies
else
echo "Usage: $0 [--uninstall] | [--import]"
echo "This script uninstalls dependencies. Use --uninstall or no argument to proceed with uninstallation."
fi
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载