mirror of
https://github.com/CerberusV1/minecraft_deploy.git
synced 2026-01-13 11:24:04 +01:00
dependencie installation
This commit is contained in:
32
deploy.sh
32
deploy.sh
@@ -58,23 +58,27 @@ check_rc_local() {
|
|||||||
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
|
# Update and install the necessary packages if required
|
||||||
if [[ $java_installed -ne 0 || $tmux_installed -ne 0 || $rc_local_modified -ne 0 ]]; then
|
echo "Checking and installing missing packages..."
|
||||||
echo "Some required programs or rc.local modifications are missing. Installing..."
|
|
||||||
|
|
||||||
# Update and install the necessary packages
|
# Update package lists
|
||||||
sudo apt update && sudo apt upgrade -y
|
sudo apt update && sudo apt upgrade -y
|
||||||
|
|
||||||
if [[ $java_installed -ne 0 ]]; then
|
# Install Java if not installed
|
||||||
|
if [[ $java_installed -ne 0 ]]; then
|
||||||
|
echo "Installing Java..."
|
||||||
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
|
# Install Tmux if not installed
|
||||||
|
if [[ $tmux_installed -ne 0 ]]; then
|
||||||
|
echo "Installing Tmux..."
|
||||||
sudo apt install -y tmux
|
sudo apt install -y tmux
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only append to rc.local if changes are missing
|
# Append to /etc/rc.local if changes are missing
|
||||||
if [[ $rc_local_modified -ne 0 ]]; then
|
if [[ $rc_local_modified -ne 0 ]]; then
|
||||||
|
echo "Adding necessary changes to /etc/rc.local..."
|
||||||
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
|
||||||
@@ -82,11 +86,9 @@ 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
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "All required programs are already installed and rc.local is configured. Proceeding with installation..."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "All required programs are already installed and rc.local is configured. Proceeding with installation..."
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user