mirror of
https://github.com/techahold/rustdeskinstall.git
synced 2025-07-12 14:47:45 +02:00
added unattended installation options
This commit is contained in:
parent
e1a9a2f8dc
commit
d4da69dd84
77
install.sh
77
install.sh
@ -1,5 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# Get Username
|
||||||
uname=$(whoami)
|
uname=$(whoami)
|
||||||
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
|
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
|
||||||
@ -93,6 +126,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Choice for DNS or IP
|
# Choice for DNS or IP
|
||||||
|
if [[ -z "$resolveip" && -z "$resolvedns" ]]; then
|
||||||
PS3='Choose your preferred option, IP or DNS/Domain:'
|
PS3='Choose your preferred option, IP or DNS/Domain:'
|
||||||
WAN=("IP" "DNS/Domain")
|
WAN=("IP" "DNS/Domain")
|
||||||
select WANOPT in "${WAN[@]}"; do
|
select WANOPT in "${WAN[@]}"; do
|
||||||
@ -115,6 +149,18 @@ break
|
|||||||
*) echo "invalid option $REPLY";;
|
*) echo "invalid option $REPLY";;
|
||||||
esac
|
esac
|
||||||
done
|
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/
|
# Make Folder /opt/rustdesk/
|
||||||
if [ ! -d "/opt/rustdesk" ]; then
|
if [ ! -d "/opt/rustdesk" ]; then
|
||||||
@ -225,14 +271,7 @@ rm rustdesk-server-linux-arm64v8.zip
|
|||||||
rm -rf arm64v8
|
rm -rf arm64v8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function setuphttp () {
|
||||||
# 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")
|
|
||||||
|
|
||||||
# Create windows install script
|
# Create windows install script
|
||||||
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/WindowsAgentAIOInstall.ps1
|
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/WindowsAgentAIOInstall.ps1
|
||||||
sudo sed -i "s|wanipreg|${wanip}|g" 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 "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 "You can access your install scripts for clients by going to http://${wanip}:8000"
|
||||||
echo -e "Username is admin and password is ${admintoken}"
|
echo -e "Username is admin and password is ${admintoken}"
|
||||||
|
if [[ -z "$http" ]]; then
|
||||||
echo "Press any key to finish install"
|
echo "Press any key to finish install"
|
||||||
while [ true ] ; do
|
while [ true ] ; do
|
||||||
read -t 3 -n 1
|
read -t 3 -n 1
|
||||||
@ -329,8 +368,19 @@ echo "waiting for the keypress"
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
break
|
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")
|
"No")
|
||||||
echo -e "Your IP/DNS Address is ${wanip}"
|
echo -e "Your IP/DNS Address is ${wanip}"
|
||||||
echo -e "Your public key is ${key}"
|
echo -e "Your public key is ${key}"
|
||||||
@ -350,3 +400,10 @@ break
|
|||||||
*) echo "invalid option $REPLY";;
|
*) echo "invalid option $REPLY";;
|
||||||
esac
|
esac
|
||||||
done
|
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…
x
Reference in New Issue
Block a user