From 49253739946dc2ab9025c37318cb7ce5ba44c536 Mon Sep 17 00:00:00 2001 From: godot Date: Fri, 9 Aug 2024 16:05:57 +0200 Subject: [PATCH] working on modul base --- README.md | 8 +++- install.sh | 15 +++--- install/base.sh | 121 +++++++++++++++++++++++++++++++++++++++++------- install/old.cfg | 34 +++++++------- 4 files changed, 136 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index a3b1ac1..8b5f8f0 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,21 @@ ## Modularity - [ ] Break into separate files - [ ] Firewall update - - [ ] My players + + [ ] install iptables + - [ ] Whitelists - My players - [ ] Base update - [ ] Mods update - [ ] Service update - [ ] Tailscale update - [ ] Test owner of master script (source/run .) - [ ] Version control - +- [ ] Error handelign +- [ ] Permisons handeling +- [ ] Put on chrono job (git pull + run install.sh) ## Eye candy - [ ] Comments +- [ ] Disable bunch of text ## Nice - [ ] do NOT store everything in repo diff --git a/install.sh b/install.sh index 167d6cc..77b4864 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,16 @@ #!/bin/bash -# Stop systemD service -# -# apt update -# Git pull +#stop service +systemctl stop mc-forge + +#update system +apt update + + # # Differencies betwen install.cfg a install-old.cfg > found what work needs to be done +# +# If uninstall check for verification # # depandencies install # files @@ -23,8 +28,6 @@ # # chown velocity:velocity # -# + all to rm -# printf "\n Everythink is now set up. It is good idea to check these:" printf "\n systemctl status mc-velocity" diff --git a/install/base.sh b/install/base.sh index bcbbdfa..69be977 100644 --- a/install/base.sh +++ b/install/base.sh @@ -1,16 +1,116 @@ #!/bin/bash +### --- Dependencies --- ### + +# If no > yes install +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="yes"]]; then + + printf "+ Installing depandencies \n" + apt install openjdk-17-jre-headless screen -printf "+ Installing depandencies \n" +# if yes > no uninstall +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="no"]]; then -apt install openjdk-17-jre-headless screen + printf "+ UNinstalling depandencies \n" + apt remove openjdk-17-jre-headless screen -if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then - apt install iptables -y +# if yes > yes update +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="yes"]]; then + + printf "+ skiping dependencies check \n" + + +# if no > no restr +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="no"]]; then + + pritf "+ skiping installation of dependencies \n" + +else + + #error handeling + fi + + +### --- User managment --- ### + +# If no > yes install +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="yes"]]; then + + printf "+ Installing depandencies \n" + apt install openjdk-17-jre-headless screen + + +# if yes > no uninstall +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="no"]]; then + + printf "+ UNinstalling depandencies \n" + apt remove openjdk-17-jre-headless screen + + +# if yes > yes update +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="yes"]]; then + + printf "+ skiping dependencies check \n" + + +# if no > no restr +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="no"]]; then + + pritf "+ skiping installation of dependencies \n" + +else + + #error handeling + +fi + + +### --- File Structure --- ### + +# If no > yes install +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="yes"]]; then + + printf "+ Installing depandencies \n" + apt install openjdk-17-jre-headless screen + + +# if yes > no uninstall +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="no"]]; then + + printf "+ UNinstalling depandencies \n" + apt remove openjdk-17-jre-headless screen + + +# if yes > yes update +if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="yes"]]; then + + printf "+ skiping dependencies check \n" + + +# if no > no restr +if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="no"]]; then + + pritf "+ skiping installation of dependencies \n" + +else + + #error handeling + +fi + + + +# +# +# +# +# +# + ### User managment printf "+ creating group and user for proxy \n" @@ -28,15 +128,4 @@ cp data/velocity*.jar start.sh /opt/velocity/ mkdir /opt/velocity/plugins -cp data/velocity.toml /opt/velocity/ -cp data/forwarding.secret /opt/velocity/ -cp data/start.sh /opt/velocity/ -cp data/server-icon.png /opt/velocity/ - -### Permisions - -printf "+ handeling permisions \n" -chown -R velocity:velocity /opt/velocity/ - - - +cp data/velocity.toml data/forwarding.secret data/start.sh data/server-icon.png $baseInstallLocation diff --git a/install/old.cfg b/install/old.cfg index 4d5c0e0..473eeb5 100644 --- a/install/old.cfg +++ b/install/old.cfg @@ -1,25 +1,23 @@ -# Base informations -lastUpdateDate= #to version control -baseInstallLocation=no -baseUserName=no -dependenciesInstalled=no #if set to no will do it -systemdService=no #if y > update, n > not -autoUpgrade=no #work in progress +### ------------ Do not change these stats, it states what job was done on this system --- ### + +# Base informationsOOUpdateDate= #to version control +oBaseInstallLocation=no +oBaseUserName=no +oDependenciesInstalled=no #if set to no will do it +oSystemdService=no #if y > update, n > not +oautoUpgrade=no #work in progress # Firewall -iptables=no #to check if installed + install -tailscale=no #to check if installed + install -sshRange=no # Ip range +oiptables=no #to check if installed + install +otailscale=no #to check if installed + install +osshRange=no # Ip range # Mods -Ambassador=no #Forge support -ReWhitelist=no #Whitelist support -SkinResolver=no #Skins with offline mode +oAmbassador=no #Forge support +oReWhitelist=no #Whitelist support +oSkinResolver=no #Skins with offline mode # Proxiing information -forwarding=no # modern/legacy #how to not set duble velocity.toml -forwardingSecret=no - - - +oforwarding=no # modern/legacy #how to not set duble velocity.toml +oforwardingSecret=no