Skip to content

Commit 7f62503

Browse files
authored
Merge pull request #2 from Sterbweise/develop
Fix plutonium update + First stable release
2 parents e37e031 + 9017341 commit 7f62503

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6345
-895
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
3+
# File: installGameBinaries.sh
4+
# Description: Script to install game binaries for the Plutonium Call of Duty: Black Ops Server
5+
# Version: 1.0.0
6+
# Author: Sterbweise
7+
# Last Updated: 12/12/2024
8+
9+
# Import global configurations
10+
if [ "$1" = "--install" ]; then
11+
source /opt/T5Server/.config/config.sh
12+
fi
13+
14+
# Function to install game binaries
15+
installGameBinaries () {
16+
{
17+
# Create directory structure for Plutonium
18+
mkdir -p "$WORKDIR/Plutonium/storage/t5/"{gamesettings,scripts,mods}
19+
20+
# Clone T5ServerConfigs repository
21+
rm -rf /tmp/T5ServerConfigs
22+
checkAndInstallCommand "git" "git"
23+
git clone https://github.com/xerxes-at/T5ServerConfig.git /tmp/T5ServerConfigs
24+
25+
# Install rsync if not present
26+
checkAndInstallCommand "rsync" "rsync"
27+
28+
# Copy configuration files
29+
if [ -d "/tmp/T5ServerConfigs/localappdata/Plutonium/storage/t5" ]; then
30+
mkdir -p "$WORKDIR/Plutonium/storage/t5"
31+
rsync -a --delete "/tmp/T5ServerConfigs/localappdata/Plutonium/storage/t5/" "$WORKDIR/Plutonium/storage/t5"
32+
fi
33+
34+
# Clean up T5ServerConfigs
35+
rm -rf /tmp/T5ServerConfigs
36+
37+
# Download required files from torrent
38+
checkAndInstallCommand "aria2c" "aria2"
39+
# Clean up any existing pluto_t5_full_game files/directories in /tmp
40+
rm -rf /tmp/pluto_t5_full_game*
41+
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"
42+
43+
# Move downloaded files to Resources
44+
rsync -a "/tmp/pluto_t5_full_game/main" "$WORKDIR/Server/"
45+
rsync -a "/tmp/pluto_t5_full_game/zone" "$WORKDIR/Server/"
46+
rsync -a "/tmp/pluto_t5_full_game/binkw32.dll" "$WORKDIR/Server/binkw32.dll"
47+
rsync -a "/tmp/pluto_t5_full_game/localization.txt" "$WORKDIR/Server/localization.txt"
48+
49+
# Clean up downloaded files
50+
rm -rf /tmp/pluto_t5_full_game
51+
52+
# Setup Plutonium updater
53+
if [ ! -f "$WORKDIR/Plutonium/plutonium-updater" ]; then
54+
cd "$WORKDIR/Plutonium/" || exit
55+
checkAndInstallCommand "wget" "wget"
56+
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
57+
checkAndInstallCommand "tar" "tar"
58+
tar xf plutonium-updater.tar.gz plutonium-updater
59+
rm plutonium-updater.tar.gz
60+
chmod +x plutonium-updater
61+
fi
62+
63+
# Make T5Server.sh executable
64+
chmod +x "$WORKDIR/Plutonium/T5Server.sh"
65+
} > /dev/null 2>&1 &
66+
showProgressIndicator "$(getMessage "binary")"
67+
68+
# Verify installation
69+
if [ ! -f "$WORKDIR/Plutonium/plutonium-updater" ]; then
70+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Game binaries installation failed.\n"
71+
printf "You can try running the installation script separately by executing:\n"
72+
printf "cd .config/binaries && ./installGameBinaries.sh\n"
73+
fi
74+
}
75+
76+
# Run the installation function if --install is provided
77+
if [ "$1" = "--import" ]; then
78+
:
79+
elif [ "$1" = "--install" ]; then
80+
installGameBinaries
81+
else
82+
echo "Usage: $0 [--install] | [--import]"
83+
echo "This script installs game binaries. Use --install or no argument to proceed with installation."
84+
fi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# File: uninstallGameBinaries.sh
4+
# Description: Script to uninstall game binaries for the Plutonium Call of Duty: Black Ops Server
5+
# Version: 1.0.0
6+
# Author: Sterbweise
7+
# Last Updated: 12/12/2024
8+
9+
# Import global configurations
10+
if [ "$1" = "--uninstall" ]; then
11+
source /opt/T5Server/.config/config.sh
12+
fi
13+
14+
# Function to uninstall game binaries
15+
uninstallGameBinaries () {
16+
{
17+
# Remove the main game directories
18+
rm -rf "$WORKDIR/Server"
19+
20+
# Remove the Plutonium directory
21+
rm -rf "$WORKDIR/Plutonium"
22+
23+
# Remove the Resources directory if it exists
24+
if [ -d "$WORKDIR/Resources" ]; then
25+
rm -rf "$WORKDIR/Resources"
26+
fi
27+
28+
# Remove the entire WORKDIR if it's empty
29+
if [ -z "$(ls -A "$WORKDIR")" ]; then
30+
rm -rf "$WORKDIR"
31+
fi
32+
33+
} > /dev/null 2>&1 &
34+
showProgressIndicator "$(getMessage "uninstall_binary")"
35+
36+
# Verify uninstallation
37+
if [ ! -d "$WORKDIR/Server" ] && [ ! -d "$WORKDIR/Plutonium" ]; then
38+
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Game binaries have been uninstalled.\n"
39+
else
40+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Game binaries uninstallation may have failed.\n"
41+
printf "You can try manually removing the directories:\n"
42+
printf "$WORKDIR/Server\n"
43+
printf "$WORKDIR/Plutonium\n"
44+
fi
45+
}
46+
47+
# Run the uninstallation function if --uninstall is provided
48+
if [ "$1" = "--import" ]; then
49+
:
50+
elif [ "$1" = "--uninstall" ]; then
51+
uninstallGameBinaries
52+
else
53+
echo "Usage: $0 [--uninstall] | [--import]"
54+
echo "This script uninstalls game binaries. Use --uninstall or no argument to proceed with uninstallation."
55+
fi

.config/config.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# config.sh - Configuration file for Plutonium Call of Duty: Black Ops Server
4+
# Version: 1.0.0
5+
# Author: Sterbweise
6+
# Last Updated: 12/12/2024
7+
8+
# Description:
9+
# This script defines global variables and configurations used across the server installation
10+
# and management scripts. It includes settings for work directories, distribution detection,
11+
# color codes for output formatting, and language preferences.
12+
13+
# Usage:
14+
# This file is sourced by other scripts and should not be executed directly.
15+
16+
# Note: Modify the variables in this file to customize your server setup.
17+
18+
# Set default language and locale settings
19+
# These ensure consistent character encoding and language behavior across the system
20+
export LANG=C.UTF-8
21+
export LC_ALL=C.UTF-8
22+
23+
# Work directory
24+
# This is the base directory where the server files will be installed
25+
WORKDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)"
26+
27+
# Distribution detection
28+
# Automatically detects the Linux distribution and version
29+
if [ -f /etc/os-release ]; then
30+
. /etc/os-release
31+
DISTRO=$ID
32+
VERSION=$VERSION_ID
33+
else
34+
# Default to Debian 10 if detection fails
35+
DISTRO="debian"
36+
VERSION="10"
37+
fi
38+
39+
# Color codes for terminal output
40+
# Import color definitions from utility/colors.sh
41+
source "$(dirname "${BASH_SOURCE[0]}")/utility/colors.sh"
42+
43+
44+
# Global variables
45+
# These variables are used across different scripts for configuration
46+
language=0 # Default language setting (0 for English)
47+
firewall="" # Firewall configuration (empty string for default behavior)
48+
ssh_port=22 # Default SSH port
49+
dotnet="" # .NET installation flag (empty string for default behavior)
50+
51+
# Function to check and install required commands
52+
checkAndInstallCommand() {
53+
local command=$1
54+
local package=$2
55+
if ! command -v "$command" &> /dev/null; then
56+
printf "Installing %s...\n" "$package"
57+
apt-get install -y "$package" > /dev/null 2>&1
58+
fi
59+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
# File: installDependencies.sh
4+
# Description: Script to install dependencies for the Plutonium Call of Duty: Black Ops Server
5+
# Version: 1.0.0
6+
# Author: Sterbweise
7+
# Last Updated: 12/12/2024
8+
9+
# Import global configurations
10+
if [ "$1" = "--install" ]; then
11+
source /opt/T5Server/.config/config.sh
12+
fi
13+
14+
# Function to install dependencies
15+
installDependencies() {
16+
{
17+
apt-get update
18+
# Install system utilities
19+
apt-get install -y \
20+
sudo \
21+
aria2 \
22+
tar \
23+
wget \
24+
gnupg2 \
25+
software-properties-common \
26+
apt-transport-https \
27+
curl \
28+
rsync \
29+
procps
30+
31+
# Install required libraries
32+
apt-get install -y \
33+
libssl1.1 \
34+
libcurl4 \
35+
libc6:i386 \
36+
libstdc++6:i386
37+
38+
} > /dev/null 2>&1 &
39+
showProgressIndicator "$(getMessage "dependencies_install")"
40+
41+
# Verify installation
42+
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
43+
then
44+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Dependencies installation failed.\n"
45+
printf "Attempting reinstallation...\n"
46+
apt-get install -y sudo wget gnupg2 software-properties-common apt-transport-https curl
47+
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
48+
then
49+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Reinstallation failed. Please check your internet connection and try again.\n"
50+
exit 1
51+
fi
52+
fi
53+
54+
if [ "$1" = "--install" ]; then
55+
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been installed.\n"
56+
fi
57+
}
58+
59+
# Run the installation function if --install is provided
60+
if [ "$1" = "--import" ]; then
61+
:
62+
elif [ "$1" = "--install" ]; then
63+
installDependencies
64+
else
65+
echo "Usage: $0 [--install] | [--import]"
66+
echo "This script installs dependencies. Use --install or no argument to proceed with installation."
67+
fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# File: uninstallDependencies.sh
4+
# Description: Script to uninstall dependencies for the Plutonium Call of Duty: Black Ops Server
5+
# Version: 1.0.0
6+
# Author: Sterbweise
7+
# Last Updated: 12/12/2024
8+
9+
# Import global configurations
10+
if [ "$1" = "--uninstall" ]; then
11+
source /opt/T5Server/.config/config.sh
12+
fi
13+
14+
# Function to uninstall dependencies
15+
uninstallDependencies() {
16+
{
17+
apt-get remove -y software-properties-common apt-transport-https
18+
apt-get autoremove -y
19+
} > /dev/null 2>&1 &
20+
showProgressIndicator "$(getMessage "cleanup")"
21+
22+
# Verify uninstallation
23+
if dpkg -s software-properties-common &> /dev/null || dpkg -s apt-transport-https &> /dev/null
24+
then
25+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Dependencies uninstallation failed.\n"
26+
printf "Attempting manual removal...\n"
27+
apt-get remove -y software-properties-common apt-transport-https
28+
apt-get autoremove -y
29+
if dpkg -s software-properties-common &> /dev/null || dpkg -s apt-transport-https &> /dev/null
30+
then
31+
printf "${COLORS[RED]}Error:${COLORS[RESET]} Manual removal failed. Some dependencies may still be present.\n"
32+
else
33+
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been manually removed.\n"
34+
fi
35+
else
36+
if [ "$1" = "--uninstall" ]; then
37+
printf "${COLORS[GREEN]}Success:${COLORS[RESET]} Dependencies have been uninstalled.\n"
38+
fi
39+
fi
40+
}
41+
42+
# Run the uninstallation function if --uninstall is provided
43+
if [ "$1" = "--import" ]; then
44+
:
45+
elif [ "$1" = "--uninstall" ]; then
46+
uninstallDependencies
47+
else
48+
echo "Usage: $0 [--uninstall] | [--import]"
49+
echo "This script uninstalls dependencies. Use --uninstall or no argument to proceed with uninstallation."
50+
fi

0 commit comments

Comments
 (0)