Update install.sh

This commit is contained in:
dinger1986 2022-08-10 00:26:47 +01:00 committed by GitHub
parent 83d2e63c5b
commit 8b2cb50fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
# Get Username
uname=$(whoami)
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
# Setup prereqs for server
@ -111,10 +112,52 @@ wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/linuxcl
sudo sed -i "s|wanipreg|${wanip}|g" linuxclientinstall.sh
sudo sed -i "s|keyreg|${key}|g" linuxclientinstall.sh
# Download and install gohttpserver
mkdir /opt/gohttp
cd /opt/gohttp
wget https://github.com/codeskyblue/gohttpserver/releases/download/1.1.4/gohttpserver_1.1.4_linux_amd64.tar.gz
tar -xf gohttpserver_1.1.4_linux_amd64.tar.gz
mkdir public
# Copy Rustdesk isntall scripts to folder
mv /opt/rustdesk/WindowsAIOInstall.ps1 /opt/gohttp/public/
mv /opt/rustdesk/linuxclientinstall.sh /opt/gohttp/public/
# Make gohttp log folders
mkdir /var/log/gohttp/
sudo chown "${uname}" -R /var/log/gohttp/
# Setup Systemd to launch Go HTTP Server
gohttpserver="$(cat << EOF
[Unit]
Description=Go HTTP Server
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/opt/gohttp/gohttpserver -r ./public --port 8000 --auth-type http --auth-http admin:${admintoken}
WorkingDirectory=/opt/gohttp/
User=${uname}
Group=${uname}
Restart=always
StandardOutput=append:/var/log/gohttp/gohttpserver.log
StandardError=append:/var/log/gohttp/gohttpserver.error
# Restart service after 10 seconds if node service crashes
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
)"
echo "${gohttpserver}" | sudo tee /etc/systemd/system/gohttpserver.service > /dev/null
sudo systemctl daemon-reload
sudo systemctl enable gohttpserver.service
sudo systemctl start gohttpserver.service
echo -e "Your IP 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"
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 "Press any key to finish install"
while [ true ] ; do