big changes, better me

This commit is contained in:
ggodot 2025-09-04 23:59:35 +02:00
parent 3db6aa42b5
commit f0ddd2ee72
4 changed files with 115 additions and 56 deletions

View File

@ -15,7 +15,10 @@ To switch user use:
- [x] config/pcf-common.toml Forwarding secrets
- [x] Update server.properties (whitelist, online-mode=false, name, ...)
- [x] ModernForwarding
- [x] LXC SSH server socket
- [x] deb13 update
- [ ] Do not stack mods in this repo
- [ ] Remaking log coments to make sense
- [ ] Better handeling farwarding secrets
- [ ] Better world gen

Binary file not shown.

View File

@ -1,3 +0,0 @@
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
#Mon Jun 24 20:33:09 UTC 2024
eula=true

163
script.sh
View File

@ -4,6 +4,32 @@ printf "Better to run as root, because of permisions handeling.\n"
sleep 2
### Deb12 > Deb13 ###
printf "Do you want to update from Debian 12 into Debian 13? [Y/n]: \n"
read ansDebUpdate
### LXC SSH configuration ###
printf "Are you using LXC and want to set up full SSH server? [Y/n]: \n"
read ansLxcSshServer
if [[ "$ansLxcSshServer" =~ ("N"|"n") ]]; then
printf "+ Thanks, working on next bit\n"
elif [[ "$ansLxcSshServer" =~ ("Y"|"y") || -z $ansLxcSshServer ]]; then
printf "+ Setting up full ssh server\n"
systemctl disable ssh.socket
systemctl enable ssh
# TODO: Prove this works, and /etc/ssh/sshd_config
# TODO: Public keys import needed?
else
printf "\nHope you know what you are doing, I am not able to check your answer."
fi
### Firewall ###
printf "Do you want to set up firewall rules by iptables? [Y/n]: \n"
@ -58,46 +84,7 @@ read maxRam
printf "How little you want to let RAM go down to in GB (Min) [1G/?G]: \n"
read minRam
if [[ "$minRam" > "$maxRam" ]]; then
pritf "\n You allocated too low max ram or too much min ram. Manual intervention at the end will be needed\n"
echo "-Xmx?G # in place of ? put number of RAM you want to set ass maximum"
$maxRam="Error"
elif [[ "$maxRam" =~ ("G"|"M") ]]; then
printf "\n+ Allocating $maxRam as RAM maximum."
echo "-Xmx$maxRam" >> data/user_jvm_args.txt
elif [[ -z $maxRam ]]; then
$maxRam=4G
printf "\n+ Allocating $MaxRam as RAM maximum"
echo "-Xmx$maxRam" >> data/user_jvm_args.txt
elif [[ ! "$maxRam" =~ ("G"|"MB") ]]; then
printf "\n+ Allocating ${maxRam}G as RAM maximum"
echo "-Xmx${maxRam}G" >> data/user_jvm_args.txt
else
pritnf "\n \n!!! Sorry I have no idea what are you trying to do :/ Manual intervention will be needed at the end \n"
$maxRam="Error"
echo "-Xmx?G # in place of ? put number of RAM you want to set ass maximum"
fi
if [[ "$minRam" > "$maxRam" ]]; then
echo "-Xms?G # in place of ? put number of RAM you want to se ass minimum"
elif [[ "$minRam" =~ ("G"|"M") ]]; then
printf "\n+ Allocating $minRam as RAM minimum."
echo "-Xms$minRam" >> data/user_jvm_args.txt
elif [[ -z $minRam ]]; then
$minRam=1G
printf "\n+ Allocating $minRam as RAM minimum"
echo "-Xms$minRam" >> data/user_jvm_args.txt
elif [[ ! "$minRam" =~ ("G"|"MB") ]]; then
printf "Allocating ${minRam}G as RAM maximum"
echo "-Xms${minRam}G" >> data/user_jvm_args.txt
else
pritnf "\n!!! Sorry I have no idea what are you trying to do :/ Manual intervention will be needed at the end \n"
$minRam="Error"
echo "-Xms?G # in place of ? put number of RAM you want to set ass minimum"
fi
### Proxy ###
printf "Are you planing to use Velocity proxy to acces this server? [Y/n]: \n"
read ansVeloProxy
@ -118,13 +105,34 @@ sleep 2
printf "\n+ Starting to upgrade base system\n\n"
apt update
apt upgrade -y
apt autoremove --purge -y
if [[ "$ansDebUpdate" =~ ("N"|"n") ]]; then
printf "+ Thanks, working on next bit\n"
elif [[ "$ansDebUpdate" =~ ("Y"|"y") || -z $ansDebUpdate ]]; then
printf "+ Working on updating Debian 12 Bookworm into Debian 13 Trixie"
# changes every bookworm int trixie
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
apt update
apt upgrade -y
apt full-upgrade -y
else
printf "\nHope you know what you are doing, I am not able to check your answer."
fi
### Installing depandencies ###
#TODO Tailscale tunel?
printf "\n+ Installing depandencies \n\n"
apt install openjdk-17-jre-headless screen p7zip-full -y
apt install openjdk-21-jre-headless screen p7zip-full -y
if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
@ -141,39 +149,90 @@ useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft mi
### File strukture ###
mkdir /opt/minecraft
mv data/Forge-1.20.1.jar /opt/minecraft/
cd /opt/minecraft/
### Installing server ###
printf "+ Installing Forge 1.20.1 \n \n"
### Download forge server ###
wget https://maven.minecraftforge.net/net/minecraftforge/forge/1.21.1-52.1.0/forge-1.21.1-52.1.0-installer.jar
java -Xms512M -Xmx2048M -jar Forge-1.20.1.jar --installServer
mv forge* Forge.jar
### Installing server ###
printf "+ Installing Forge 1.21.1 \n \n"
java -Xms512M -Xmx2048M -jar Forge.jar --installServer
### RAM configuration ###
if [[ "$minRam" > "$maxRam" ]]; then
pritf "\n You allocated too low max ram or too much min ram. Manual intervention at the end will be needed\n"
echo "-Xmx?G # in place of ? put number of RAM you want to set ass maximum"
$maxRam="Error"
elif [[ "$maxRam" =~ ("G"|"M") ]]; then
printf "\n+ Allocating $maxRam as RAM maximum."
echo "-Xmx$maxRam" >> user_jvm_args.txt
elif [[ -z $maxRam ]]; then
$maxRam=4G
printf "\n+ Allocating $MaxRam as RAM maximum"
echo "-Xmx$maxRam" >> user_jvm_args.txt
elif [[ ! "$maxRam" =~ ("G"|"MB") ]]; then
printf "\n+ Allocating ${maxRam}G as RAM maximum"
echo "-Xmx${maxRam}G" >> user_jvm_args.txt
else
pritnf "\n \n!!! Sorry I have no idea what are you trying to do :/ Manual intervention will be needed at the end \n"
$maxRam="Error"
echo "-Xmx?G # in place of ? put number of RAM you want to set ass maximum"
fi
if [[ "$minRam" > "$maxRam" ]]; then
echo "-Xms?G # in place of ? put number of RAM you want to se ass minimum"
elif [[ "$minRam" =~ ("G"|"M") ]]; then
printf "\n+ Allocating $minRam as RAM minimum."
echo "-Xms$minRam" >> user_jvm_args.txt
elif [[ -z $minRam ]]; then
$minRam=1G
printf "\n+ Allocating $minRam as RAM minimum"
echo "-Xms$minRam" >> user_jvm_args.txt
elif [[ ! "$minRam" =~ ("G"|"MB") ]]; then
printf "Allocating ${minRam}G as RAM maximum"
echo "-Xms${minRam}G" >> user_jvm_args.txt
else
pritnf "\n!!! Sorry I have no idea what are you trying to do :/ Manual intervention will be needed at the end \n"
$minRam="Error"
echo "-Xms?G # in place of ? put number of RAM you want to set ass minimum"
fi
### Other shit configuraton ###
echo eula=true > eula.txt
cd -
cd data/
mv eula.txt server-icon.png server.properties run.sh user_jvm_args.txt /opt/minecraft/
cd ..
mv server-icon.png server.properties /opt/minecraft/
cd /opt/minecraft/
### Mods handling ###
mkdir /opt/minecraft/mods
printf "\n+ Unpacking mods \n \n"
#TODO Not like this, what about to downlad them
cd -
cd data
7z x Mods.zip -o/opt/minecraft/mods/
cd ..
cd /opt/minecraft/
#TODO Not like this, what about to wget it?
# adds mode to help comunicate with VeloProxy
if [[ "$ansVeloProxy" =~ ["y"|"Y"] || -z $ansVeloProxy ]]; then
mv data/proxy-compatible-forge*.jar /opt/minecraft/mods/
if [[ "$ansModernFarward" =~ ["y"|"Y"] || -z $ansModernFarward ]]; then
mkdir /opt/minecraft/config
mv data/pcf-common.toml /opt/minecraft/config/
mv data/pcf-common.toml /opt/minecraft/config/ #TODO Research this shit
fi
fi
#TODO Not like this, what about wget?
# adds aditional mods
if [[ "$ansSkinRestorer" =~ ["y"|"Y"] || -z $ansSkinRestorer ]]; then
mv data/skinrestorer-forge*.jar /opt/minecraft/mods/