mirror of
https://github.com/techahold/rustdeskinstall.git
synced 2024-06-13 01:14:43 +02:00
Merge pull request #57 from carefreepineapple/master
added unattended installation options
This commit is contained in:
commit
43df6297a9
77
install.sh
77
install.sh
|
@ -1,5 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get user options
|
||||
while getopts i:-: option; do
|
||||
case "${option}" in
|
||||
-)
|
||||
case "${OPTARG}" in
|
||||
help)
|
||||
help="true";;
|
||||
resolveip)
|
||||
resolveip="true";;
|
||||
resolvedns)
|
||||
val="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
||||
resolvedns=${val};;
|
||||
install-http)
|
||||
http="true";;
|
||||
skip-http)
|
||||
http="false";;
|
||||
esac;;
|
||||
i) resolveip="true";;
|
||||
esac
|
||||
done
|
||||
|
||||
function displayhelp() {
|
||||
if [[ ! -z $help ]]; then
|
||||
echo 'usage: install.sh --resolveip --resolvedns "fqdn"'
|
||||
echo "options:"
|
||||
echo "--resolveip Use IP for server name. Cannot use in combination with --resolvedns or -d"
|
||||
echo '--resolvedns "fqdn" Use FQDN for server name. Cannot use in combination with --resolveip or -i'
|
||||
echo "--install-http Install http server to host installation scripts. Cannot use in combination with --skip-http or -n"
|
||||
echo "--skip-http Skip installation of http server. Cannot use in combination with --install-http or -h"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
displayhelp
|
||||
# Get Username
|
||||
uname=$(whoami)
|
||||
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
|
||||
|
@ -93,6 +126,7 @@ else
|
|||
fi
|
||||
|
||||
# Choice for DNS or IP
|
||||
if [[ -z "$resolveip" && -z "$resolvedns" ]]; then
|
||||
PS3='Choose your preferred option, IP or DNS/Domain:'
|
||||
WAN=("IP" "DNS/Domain")
|
||||
select WANOPT in "${WAN[@]}"; do
|
||||
|
@ -115,6 +149,18 @@ break
|
|||
*) echo "invalid option $REPLY";;
|
||||
esac
|
||||
done
|
||||
elif [[ ! -z "$resolveip" && ! -z "$resolvedns" ]]; then
|
||||
echo -e "\nERROR: You cannot use both --resolveip & --resolvedns options simultaneously"
|
||||
exit 1
|
||||
elif [[ ! -z "$resolveip" && -z "$resolvedns" ]]; then
|
||||
wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
|
||||
elif [[ -z "$resolveip" && ! -z "$resolvedns" ]]; then
|
||||
wanip="$resolvedns"
|
||||
if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then
|
||||
echo -e "${RED}Invalid domain/dns address${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make Folder /opt/rustdesk/
|
||||
if [ ! -d "/opt/rustdesk" ]; then
|
||||
|
@ -225,14 +271,7 @@ rm rustdesk-server-linux-arm64v8.zip
|
|||
rm -rf arm64v8
|
||||
fi
|
||||
|
||||
|
||||
# Choice for Extras installed
|
||||
PS3='Please choose if you want to download configs and install HTTP server:'
|
||||
EXTRA=("Yes" "No")
|
||||
select EXTRAOPT in "${EXTRA[@]}"; do
|
||||
case $EXTRAOPT in
|
||||
"Yes")
|
||||
|
||||
function setuphttp () {
|
||||
# Create windows install script
|
||||
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/WindowsAgentAIOInstall.ps1
|
||||
sudo sed -i "s|wanipreg|${wanip}|g" WindowsAgentAIOInstall.ps1
|
||||
|
@ -318,7 +357,7 @@ echo -e "Your public key is ${key}"
|
|||
echo -e "Install Rustdesk on your machines and change your public key and IP/DNS name to the above"
|
||||
echo -e "You can access your install scripts for clients by going to http://${wanip}:8000"
|
||||
echo -e "Username is admin and password is ${admintoken}"
|
||||
|
||||
if [[ -z "$http" ]]; then
|
||||
echo "Press any key to finish install"
|
||||
while [ true ] ; do
|
||||
read -t 3 -n 1
|
||||
|
@ -329,8 +368,19 @@ echo "waiting for the keypress"
|
|||
fi
|
||||
done
|
||||
break
|
||||
;;
|
||||
fi
|
||||
}
|
||||
|
||||
# Choice for Extras installed
|
||||
if [[ -z "$http" ]]; then
|
||||
PS3='Please choose if you want to download configs and install HTTP server:'
|
||||
EXTRA=("Yes" "No")
|
||||
select EXTRAOPT in "${EXTRA[@]}"; do
|
||||
case $EXTRAOPT in
|
||||
"Yes")
|
||||
setuphttp
|
||||
break
|
||||
;;
|
||||
"No")
|
||||
echo -e "Your IP/DNS Address is ${wanip}"
|
||||
echo -e "Your public key is ${key}"
|
||||
|
@ -350,3 +400,10 @@ break
|
|||
*) echo "invalid option $REPLY";;
|
||||
esac
|
||||
done
|
||||
elif [ "$http" = "true" ]; then
|
||||
setuphttp
|
||||
elif [ "$http" = "false" ]; then
|
||||
echo -e "Your IP/DNS Address is ${wanip}"
|
||||
echo -e "Your public key is ${key}"
|
||||
echo -e "Install Rustdesk on your machines and change your public key and IP/DNS name to the above"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user