mirror of
https://github.com/CerberusV1/minecraft_deploy.git
synced 2026-01-13 03:23:42 +01:00
checking depends back in
This commit is contained in:
106
deploy.sh
106
deploy.sh
@@ -25,69 +25,69 @@ EOF
|
|||||||
echo "Checking dependencies..."
|
echo "Checking dependencies..."
|
||||||
sleep 2
|
sleep 2
|
||||||
# Function to check if a program is installed
|
# Function to check if a program is installed
|
||||||
# check_installed() {
|
check_installed() {
|
||||||
# if ! which "$1" > /dev/null 2>&1; then
|
if ! which "$1" > /dev/null 2>&1; then
|
||||||
# echo "$1 will be installed..."
|
echo "$1 will be installed..."
|
||||||
# return 1
|
return 1
|
||||||
# else
|
else
|
||||||
# echo "$1 is already installed."
|
echo "$1 is already installed."
|
||||||
# return 0
|
return 0
|
||||||
# fi
|
fi
|
||||||
# }
|
}
|
||||||
|
|
||||||
# # Check if Java is installed
|
# Check if Java is installed
|
||||||
# check_installed java
|
check_installed java
|
||||||
# java_installed=$?
|
java_installed=$?
|
||||||
|
|
||||||
# # Check if Tmux is installed
|
# Check if Tmux is installed
|
||||||
# check_installed tmux
|
check_installed tmux
|
||||||
# tmux_installed=$?
|
tmux_installed=$?
|
||||||
|
|
||||||
# # Function to check if /etc/rc.local already contains the required lines
|
# Function to check if /etc/rc.local already contains the required lines
|
||||||
# check_rc_local() {
|
check_rc_local() {
|
||||||
# if grep -q "exec 1>/tmp/rc.local.log 2>&1" /etc/rc.local && grep -q "set -x" /etc/rc.local; then
|
if grep -q "exec 1>/tmp/rc.local.log 2>&1" /etc/rc.local && grep -q "set -x" /etc/rc.local; then
|
||||||
# echo "rc.local is already configured"
|
echo "rc.local is already configured"
|
||||||
# return 0
|
return 0
|
||||||
# else
|
else
|
||||||
# echo "rc.local not configured"
|
echo "rc.local not configured"
|
||||||
# return 1
|
return 1
|
||||||
# fi
|
fi
|
||||||
# }
|
}
|
||||||
|
|
||||||
# # Check if the changes in rc.local are already applied
|
# Check if the changes in rc.local are already applied
|
||||||
# check_rc_local
|
check_rc_local
|
||||||
# rc_local_modified=$?
|
rc_local_modified=$?
|
||||||
|
|
||||||
# # If Java or Tmux is not installed, or rc.local is not modified, install/modify
|
# If Java or Tmux is not installed, or rc.local is not modified, install/modify
|
||||||
# if [[ $java_installed -ne 0 || $tmux_installed -ne 0 || $rc_local_modified -ne 0 ]]; then
|
if [[ $java_installed -ne 0 || $tmux_installed -ne 0 || $rc_local_modified -ne 0 ]]; then
|
||||||
# echo "Some required programs or rc.local modifications are missing. Installing..."
|
echo "Some required programs or rc.local modifications are missing. Installing..."
|
||||||
|
|
||||||
# # Update and install the necessary packages
|
# Update and install the necessary packages
|
||||||
# sudo apt update && sudo apt upgrade -y
|
sudo apt update && sudo apt upgrade -y
|
||||||
|
|
||||||
# if [[ $java_installed -ne 0 ]]; then
|
if [[ $java_installed -ne 0 ]]; then
|
||||||
# sudo apt install -y openjdk-17-jdk openjdk-17-jre-headless
|
sudo apt install -y openjdk-17-jdk openjdk-17-jre-headless
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# if [[ $tmux_installed -ne 0 ]]; then
|
if [[ $tmux_installed -ne 0 ]]; then
|
||||||
# sudo apt install -y tmux
|
sudo apt install -y tmux
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# # Only append to rc.local if changes are missing
|
# Only append to rc.local if changes are missing
|
||||||
# if [[ $rc_local_modified -ne 0 ]]; then
|
if [[ $rc_local_modified -ne 0 ]]; then
|
||||||
# sudo tee -a /etc/rc.local > /dev/null <<EOL
|
sudo tee -a /etc/rc.local > /dev/null <<EOL
|
||||||
# #!/bin/bash
|
#!/bin/bash
|
||||||
# exec 1>/tmp/rc.local.log 2>&1
|
exec 1>/tmp/rc.local.log 2>&1
|
||||||
# set -x
|
set -x
|
||||||
# EOL
|
EOL
|
||||||
# # Make /etc/rc.local executable
|
# Make /etc/rc.local executable
|
||||||
# sudo chmod +x /etc/rc.local
|
sudo chmod +x /etc/rc.local
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# else
|
else
|
||||||
# echo "All required programs are already installed and rc.local is configured. Proceeding with installation..."
|
echo "All required programs are already installed and rc.local is configured. Proceeding with installation..."
|
||||||
# fi
|
fi
|
||||||
# sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user