Compare commits

..

No commits in common. "42986ee5f81a6cd8f3e9aeb81e51e9c3b2b26f4d" and "0e6197186eeb2c80198db77e51fce0893590dab9" have entirely different histories.

5 changed files with 52 additions and 264 deletions

View File

@ -4,37 +4,28 @@
- [ ] Forwarding secret insert - [ ] Forwarding secret insert
- [ ] Forwarding type insert - [ ] Forwarding type insert
- [ ] Apt installed pakages - [ ] Apt installed pakages
- [ ] check on new dependency - [ ] on chenge y>n remove
- [x] Detect change and move - [ ] on change n>y install
- [ ] Detect status
- [x] Iptables add
- [ ] File structure
- [ ] Datect change and move
- [ ] User managment
- [ ] Datect change and move
- [ ] Insert date in to .cfg - [ ] Insert date in to .cfg
- [ ] Automake old.cfg - [ ] Automake old.cfg
- [ ] AutoUpgrade
- [ ] Owner and permisions - [ ] Owner and permisions
- [ ] Starting script to elevate priviliges - [ ] Starting script to alevate priviliges
## Modularity ## Modularity
- [ ] Break into separate files - [ ] Break into separate files
- [ ] Firewall update - [ ] Firewall update
- [ ] Whitelists - My players - [ ] My players
- [ ] Base update - [ ] Base update
- [ ] Nakolik duverovat old.cfg / check system
- [ ] Mods update - [ ] Mods update
- [ ] Service update - [ ] Service update
- [ ] Tailscale update - [ ] Tailscale update
- [ ] Test owner of master script (source/run .) - [ ] Test owner of master script (source/run .)
- [ ] Version control - [ ] Version control
- [ ] Error handelign
- [ ] Permisons handeling
- [ ] Put on chrono job (git pull + run install.sh)
## Eye candy ## Eye candy
- [ ] Comments - [ ] Comments
- [ ] Disable bunch of text
## Nice ## Nice
- [ ] do NOT store everything in repo - [ ] do NOT store everything in repo

View File

@ -2,9 +2,9 @@
lastUpdateDate= #to version control lastUpdateDate= #to version control
baseInstallLocation=/opt/velocity/ baseInstallLocation=/opt/velocity/
baseUserName=velocity baseUserName=velocity
dependenciesInstalled=('openjdk-17-jre-headless' 'screen') dependenciesInstalled=yes #if set to no will do it
systemdService=yes #if y > update, n > disable systemdService=yes #if y > update, n > not
autoUpgrade=yes autoUpgrade=yes #work in progress
# Firewall # Firewall
iptables=yes #to check if installed + install iptables=yes #to check if installed + install

View File

@ -1,89 +1,12 @@
#!/bin/bash #!/bin/bash
# import configs # Stop systemD service
. install.cfg #
. install/old.cfg # apt update
# Git pull
#stop service
systemctl stop mc-forge
#update system
apt update
if [[ "$autoUpgrade" == "yes" ]]; then
apt upgrade -y
fi
### Template on chack
: '
old=""
new=""
if [[ "$old" == "yes" && "$new" == "yes" ]]; then
# dubble yes
echo "check"
elif [[ "$old" == "no" && "$new" == "yes" ]]; then
# no > yes
echo "install"
elif [[ "$old" == "no" && "$new" == "no" ]]; then
# dubble no
echo "report"
elif [[ "$old" == "yes" && "$new" == "no" ]]; then
# yes > no
echo "uninstall"
else
#error handeling
fi
'
### Base dependencies check
# !TODO it is not bulean
old="oDependenciesInstalled"
new="dependenciesInstalled"
if [[ "$new" == "yes" ]]; then
BaseDep="install"
elif [[ "$old" == "no"]]; then
# dubble no
BaseDep="report"
elif [[ "$old" == "yes"]]; then
# yes > no
BaseDep="uninstall"
else
#error handeling
fi
### Template on chack
old=""
new=""
if [[ "$old" == "yes" && "$new" == "yes" ]]; then
# dubble yes
echo "check"
elif [[ "$old" == "no" && "$new" == "yes" ]]; then
# no > yes
echo "install"
elif [[ "$old" == "no" && "$new" == "no" ]]; then
# dubble no
echo "report"
elif [[ "$old" == "yes" && "$new" == "no" ]]; then
# yes > no
echo "uninstall"
else
#error handeling
fi
# #
# Differencies betwen install.cfg a install-old.cfg > found what work needs to be done # Differencies betwen install.cfg a install-old.cfg > found what work needs to be done
# #
# If uninstall check for verification
#
# depandencies install # depandencies install
# files # files
# user # user
@ -100,6 +23,8 @@ fi
# #
# chown velocity:velocity # chown velocity:velocity
# #
# + all to rm
#
printf "\n Everythink is now set up. It is good idea to check these:" printf "\n Everythink is now set up. It is good idea to check these:"
printf "\n systemctl status mc-velocity" printf "\n systemctl status mc-velocity"

View File

@ -1,157 +1,16 @@
#!/bin/bash #!/bin/bash
# TODO! check for new dependency
### Checks dependencies ###
DepNum=0
DepMissing=()
DepInstalled=()
if [[ "$iptables" == "yes" ]]; then
dependencies+=('iptables')
fi
for pkg in "${dependencies[@]}"; do
if [[ '$(dpkg-query -w --showformat="${Status}\n" $pkg | grep "install ok installed")' =~ ("install"|"ok"|"installed") ]]; then
# pkg is installed
((DepNum++))
DepInstalled+=("$pkg")
else
# pkg is NOT installed
DepMissing+=("$pkg")
fi
done
### Count dependencies ###
if [[ "$DepNum" == "${#dependencies[@]}" ]]; then
#All dependencies are installed
DepStatus="all"
elif [[ "${#DepMissing[@]}" == "${#dependencies[@]}" ]]; then
#All dependencies are missing
DepStatus="none"
else
#Something is missing
DepStatus="some"
fi
### --- ###
if [[ "$BaseDep" == ("install") && "$DepStatus" == "all" ]]; then
# everything is allright
pritnf "it is done bro \n"
elif [[ "$BaseDep" == ("install") && "$DepStatus" == ("none"|"some") ]]; then
# some or none was installed installing rest
apt install ${DepMissing[@]}
printf "it is done now bro \n"
elif [[ "$BaseDep" == "uninstall" && "$DepStatus" == "none" ]]; then
# uninstall but it is not there
elif [[ "$BaseDep" == "uninstall" && "$DepStatus" == ("some"|"all") ]]; then
# uninstall
apt remove ${DepMissing[@]}
elif [[ "$BaseDep" == "report" && "$DepStatus" == "none" ]]; then
# nothing to do
elif [[ "$BaseDep" == "report" && "$DepStatus" == ("some"|"all") ]]; then
printf "Do you want to uinstall these dependencies? [Y/n]
printf "${DepInstalled[@]}
read ansReport
if [[ "$ansReport" =~ ("y"|"Y"|"yes"|"Yes") || -z $ansReport ]]; then
apt remove ${DepMissing[@]}
else
printf "Hope you know what you are doing."
fi
else
# error handeling
fi
### ------------ Needs work ----------- ###
### --- User managment --- ###
# If no > yes install
if [[ "$oDependenciesInstalled"="no" && "$dependenciesInstalled"="yes"]]; then
printf "+ Installing depandencies \n" printf "+ Installing depandencies \n"
apt install openjdk-17-jre-headless screen apt install openjdk-17-jre-headless screen
# if yes > no uninstall if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
if [[ "$oDependenciesInstalled"="yes" && "$dependenciesInstalled"="no"]]; then apt install iptables -y
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 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 ### User managment
printf "+ creating group and user for proxy \n" printf "+ creating group and user for proxy \n"
@ -169,4 +28,15 @@ cp data/velocity*.jar start.sh /opt/velocity/
mkdir /opt/velocity/plugins mkdir /opt/velocity/plugins
cp data/velocity.toml data/forwarding.secret data/start.sh data/server-icon.png $baseInstallLocation 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/

View File

@ -1,23 +1,25 @@
### ------------ Do not change these stats, it states what job was done on this system --- ### # Base informations
lastUpdateDate= #to version control
# Base informationsOOUpdateDate= #to version control baseInstallLocation=no
oBaseInstallLocation=no baseUserName=no
oBaseUserName=no dependenciesInstalled=no #if set to no will do it
oDependenciesInstalled=no #if set to no will do it systemdService=no #if y > update, n > not
oSystemdService=no #if y > update, n > not autoUpgrade=no #work in progress
oautoUpgrade=no #work in progress
# Firewall # Firewall
oiptables=no #to check if installed + install iptables=no #to check if installed + install
otailscale=no #to check if installed + install tailscale=no #to check if installed + install
osshRange=no # Ip range sshRange=no # Ip range
# Mods # Mods
oAmbassador=no #Forge support Ambassador=no #Forge support
oReWhitelist=no #Whitelist support ReWhitelist=no #Whitelist support
oSkinResolver=no #Skins with offline mode SkinResolver=no #Skins with offline mode
# Proxiing information # Proxiing information
oforwarding=no # modern/legacy #how to not set duble velocity.toml forwarding=no # modern/legacy #how to not set duble velocity.toml
oforwardingSecret=no forwardingSecret=no