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 type insert
|
||||
- [ ] Apt installed pakages
|
||||
- [ ] on chenge y>n remove
|
||||
- [ ] on change n>y install
|
||||
- [ ] check on new dependency
|
||||
- [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
|
||||
- [ ] Automake old.cfg
|
||||
- [ ] AutoUpgrade
|
||||
- [ ] Owner and permisions
|
||||
- [ ] Starting script to alevate priviliges
|
||||
- [ ] Starting script to elevate priviliges
|
||||
|
||||
## Modularity
|
||||
- [ ] Break into separate files
|
||||
- [ ] Firewall update
|
||||
- [ ] My players
|
||||
- [ ] Whitelists - My players
|
||||
- [ ] Base update
|
||||
- [ ] Nakolik duverovat old.cfg / check system
|
||||
- [ ] 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
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
lastUpdateDate= #to version control
|
||||
baseInstallLocation=/opt/velocity/
|
||||
baseUserName=velocity
|
||||
dependenciesInstalled=yes #if set to no will do it
|
||||
systemdService=yes #if y > update, n > not
|
||||
autoUpgrade=yes #work in progress
|
||||
dependenciesInstalled=('openjdk-17-jre-headless' 'screen')
|
||||
systemdService=yes #if y > update, n > disable
|
||||
autoUpgrade=yes
|
||||
|
||||
# Firewall
|
||||
iptables=yes #to check if installed + install
|
||||
|
||||
87
install.sh
87
install.sh
@ -1,12 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Stop systemD service
|
||||
#
|
||||
# apt update
|
||||
# Git pull
|
||||
# import configs
|
||||
. install.cfg
|
||||
. install/old.cfg
|
||||
|
||||
|
||||
#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
|
||||
#
|
||||
# If uninstall check for verification
|
||||
#
|
||||
# depandencies install
|
||||
# files
|
||||
# user
|
||||
@ -23,8 +100,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"
|
||||
|
||||
160
install/base.sh
160
install/base.sh
@ -1,16 +1,157 @@
|
||||
#!/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"
|
||||
|
||||
apt install openjdk-17-jre-headless screen
|
||||
|
||||
|
||||
if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
|
||||
apt install iptables -y
|
||||
# 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 +169,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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user