Compare commits
2 Commits
0e6197186e
...
42986ee5f8
| Author | SHA1 | Date | |
|---|---|---|---|
| 42986ee5f8 | |||
| 4925373994 |
21
README.md
21
README.md
@ -4,28 +4,37 @@
|
|||||||
- [ ] Forwarding secret insert
|
- [ ] Forwarding secret insert
|
||||||
- [ ] Forwarding type insert
|
- [ ] Forwarding type insert
|
||||||
- [ ] Apt installed pakages
|
- [ ] Apt installed pakages
|
||||||
- [ ] on chenge y>n remove
|
- [ ] check on new dependency
|
||||||
- [ ] on change n>y install
|
- [x] Detect change and move
|
||||||
|
- [ ] 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 alevate priviliges
|
- [ ] Starting script to elevate priviliges
|
||||||
|
|
||||||
## Modularity
|
## Modularity
|
||||||
- [ ] Break into separate files
|
- [ ] Break into separate files
|
||||||
- [ ] Firewall update
|
- [ ] Firewall update
|
||||||
- [ ] My players
|
- [ ] Whitelists - 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
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
lastUpdateDate= #to version control
|
lastUpdateDate= #to version control
|
||||||
baseInstallLocation=/opt/velocity/
|
baseInstallLocation=/opt/velocity/
|
||||||
baseUserName=velocity
|
baseUserName=velocity
|
||||||
dependenciesInstalled=yes #if set to no will do it
|
dependenciesInstalled=('openjdk-17-jre-headless' 'screen')
|
||||||
systemdService=yes #if y > update, n > not
|
systemdService=yes #if y > update, n > disable
|
||||||
autoUpgrade=yes #work in progress
|
autoUpgrade=yes
|
||||||
|
|
||||||
# Firewall
|
# Firewall
|
||||||
iptables=yes #to check if installed + install
|
iptables=yes #to check if installed + install
|
||||||
|
|||||||
87
install.sh
87
install.sh
@ -1,12 +1,89 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Stop systemD service
|
# import configs
|
||||||
#
|
. install.cfg
|
||||||
# apt update
|
. install/old.cfg
|
||||||
# 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
|
||||||
@ -23,8 +100,6 @@
|
|||||||
#
|
#
|
||||||
# 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"
|
||||||
|
|||||||
168
install/base.sh
168
install/base.sh
@ -1,16 +1,157 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# TODO! check for new dependency
|
||||||
|
|
||||||
|
### Checks dependencies ###
|
||||||
|
DepNum=0
|
||||||
|
DepMissing=()
|
||||||
|
DepInstalled=()
|
||||||
|
|
||||||
printf "+ Installing depandencies \n"
|
if [[ "$iptables" == "yes" ]]; then
|
||||||
|
dependencies+=('iptables')
|
||||||
apt install openjdk-17-jre-headless screen
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
|
|
||||||
apt install iptables -y
|
|
||||||
fi
|
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"
|
||||||
|
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
|
### User managment
|
||||||
|
|
||||||
printf "+ creating group and user for proxy \n"
|
printf "+ creating group and user for proxy \n"
|
||||||
@ -28,15 +169,4 @@ cp data/velocity*.jar start.sh /opt/velocity/
|
|||||||
|
|
||||||
mkdir /opt/velocity/plugins
|
mkdir /opt/velocity/plugins
|
||||||
|
|
||||||
cp data/velocity.toml /opt/velocity/
|
cp data/velocity.toml data/forwarding.secret data/start.sh data/server-icon.png $baseInstallLocation
|
||||||
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/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,25 +1,23 @@
|
|||||||
# Base informations
|
### ------------ Do not change these stats, it states what job was done on this system --- ###
|
||||||
lastUpdateDate= #to version control
|
|
||||||
baseInstallLocation=no
|
# Base informationsOOUpdateDate= #to version control
|
||||||
baseUserName=no
|
oBaseInstallLocation=no
|
||||||
dependenciesInstalled=no #if set to no will do it
|
oBaseUserName=no
|
||||||
systemdService=no #if y > update, n > not
|
oDependenciesInstalled=no #if set to no will do it
|
||||||
autoUpgrade=no #work in progress
|
oSystemdService=no #if y > update, n > not
|
||||||
|
oautoUpgrade=no #work in progress
|
||||||
|
|
||||||
# Firewall
|
# Firewall
|
||||||
iptables=no #to check if installed + install
|
oiptables=no #to check if installed + install
|
||||||
tailscale=no #to check if installed + install
|
otailscale=no #to check if installed + install
|
||||||
sshRange=no # Ip range
|
osshRange=no # Ip range
|
||||||
|
|
||||||
# Mods
|
# Mods
|
||||||
Ambassador=no #Forge support
|
oAmbassador=no #Forge support
|
||||||
ReWhitelist=no #Whitelist support
|
oReWhitelist=no #Whitelist support
|
||||||
SkinResolver=no #Skins with offline mode
|
oSkinResolver=no #Skins with offline mode
|
||||||
|
|
||||||
# Proxiing information
|
# Proxiing information
|
||||||
forwarding=no # modern/legacy #how to not set duble velocity.toml
|
oforwarding=no # modern/legacy #how to not set duble velocity.toml
|
||||||
forwardingSecret=no
|
oforwardingSecret=no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user