do more with less

This commit is contained in:
Daniel Hansson authored and GitHub committed 2023-10-04 19:46:53 +02:00
1 parent bf6ab0af5f
commit 381558aedd
1 file changed
+18 -31
+18 -31
View File
@@ -3,7 +3,7 @@
# This script will do the following to install RustDesk Server Pro # This script will do the following to install RustDesk Server Pro
# 1. Install some dependencies # 1. Install some dependencies
# 2. Setup UFW firewall if available # 2. Setup UFW firewall if available
# 3. Create 2 folders /var/lib/rustdesk-server and /var/log/rustdesk-server ("$RUSTDESK_LOG_DIR") # 3. Create 2 folders /var/lib/rustdesk-server and /var/log/rustdesk-server ("$RUSTDESK_INSTALL_DIR" and "$RUSTDESK_LOG_DIR")
# 4. Download and extract RustDesk Pro Services to the above folder # 4. Download and extract RustDesk Pro Services to the above folder
# 5. Create systemd services for hbbs and hbbr # 5. Create systemd services for hbbs and hbbr
# 6. If you choose Domain, it will install Nginx and Certbot, allowing the API to be available on port 443 (https) and get an SSL certificate over port 80, it is automatically renewed # 6. If you choose Domain, it will install Nginx and Certbot, allowing the API to be available on port 443 (https) and get an SSL certificate over port 80, it is automatically renewed
@@ -41,7 +41,7 @@ elif [ -x "$(command -v emerge)" ]
then then
sudo emerge -av $packagesNeeded sudo emerge -av $packagesNeeded
else else
echo "FAILED TO INSTALL PACKAGE: Package manager not found. You must manually install: $packagesNeeded">&2 echo "FAILED TO INSTALL PACKAGE! Package manager not found. You must manually install: $packagesNeeded">&2
fi fi
# We need to source directly from the Github repo to be able to use the functions here # We need to source directly from the Github repo to be able to use the functions here
@@ -69,8 +69,11 @@ install_linux_package tar
install_linux_package whiptail install_linux_package whiptail
install_linux_package dnsutils install_linux_package dnsutils
install_linux_package ufw install_linux_package ufw
install_linux_package bind-utils
install_linux_package bind install_linux_package bind
if ! install_linux_package bind-utils
then
install_linux_package bind9
fi
# Select user for installation # Select user for installation
msg_box "Rustdesk can be installed as an unprivileged user, but we need root for everything else. msg_box "Rustdesk can be installed as an unprivileged user, but we need root for everything else.
@@ -358,41 +361,26 @@ Please check https://www.whatsmydns.net/#A/${RUSTDESK_DOMAIN} if the IP seems co
exit 1 exit 1
fi fi
print_text_in_color "$IGreen" "Installing Nginx and Cerbot..."
print_text_in_color "$IGreen" "Installing Nginx" if yesno_box_yes "We use Certbot to generate the free TLS certificate from Let's Encrypt.
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]
then
if yesno_box_yes "We use Certbot to generate the free TLS certificate from Let's Encrypt.
The default behavior of installing Certbot is to use the snap package which auto updates, and provides the latest version of Certbot. If you don't like snap packages, you can opt out now and we'll use regular (old) deb packages instead. The default behavior of installing Certbot is to use the snap package which auto updates, and provides the latest version of Certbot. If you don't like snap packages, you can opt out now and we'll use regular (old) deb packages instead.
Do you want to install Certbot with snap? (recommended)" Do you want to install Certbot with snap? (recommended)"
then then
apt-get install nginx -y install_linux_package nginx
apt-get install snapd -y if ! install_linux_package snapd
snap install certbot --classic print_text_in_color "$IRed" "Sorry, snapd wasn't found on your system, reverting to python-certbot."
install_linux_package python3-certbot-nginx
else
snap install certbot --classic
fi
else else
apt-get install nginx -y install_linux_package nginx
apt-get install python3-certbot-nginx -y install_linux_package python3-certbot-nginx
fi
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "${UPSTREAM_ID}" = "rhel" ] || [ "${OS}" = "Almalinux" ] || [ "${UPSTREAM_ID}" = "Rocky*" ]
then
# openSUSE 15.4 fails to run the relay service and hangs waiting for it
# Needs more work before it can be enabled
# || [ "${UPSTREAM_ID}" = "suse" ]
yum -y install nginx
yum -y install python3-certbot-nginx
elif [ "${ID}" = "arch" ] || [ "${UPSTREAM_ID}" = "arch" ]
then
pacman -S install nginx
pacman -S install python3-certbot-nginx
else
msg_box "Sorry, your OS is unsupported"
if ! yesno_box_no "It might work anyway though... Do you want to give it a shot?"
then
exit 1
fi fi
fi fi
# Add Nginx config
if [ ! -f "/etc/nginx/sites-available/rustdesk.conf" ] if [ ! -f "/etc/nginx/sites-available/rustdesk.conf" ]
then then
rm -f "/etc/nginx/sites-available/rustdesk.conf" rm -f "/etc/nginx/sites-available/rustdesk.conf"
@@ -470,4 +458,3 @@ fi
print_text_in_color "$IGreen" "Cleaning up..." print_text_in_color "$IGreen" "Cleaning up..."
rm -f rustdesk-server-linux-"${ACTUAL_TAR_NAME}".zip rm -f rustdesk-server-linux-"${ACTUAL_TAR_NAME}".zip
rm -rf "${ACTUAL_TAR_NAME}" rm -rf "${ACTUAL_TAR_NAME}"
rm -f lib.sh