Update update.sh

This commit is contained in:
Mr-Update 2023-07-18 22:56:19 +02:00 committed by GitHub
parent 1f53613115
commit 8fa76603cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
# Get Username # Get username
uname=$(whoami) # not used btw .. yet uname=$(whoami) # not used btw ... yet
# Get current release version # Get current release version
RDLATEST=$(curl https://api.github.com/repos/rustdesk/rustdesk-server-pro/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }' | sed 's/-.*//') RDLATEST=$(curl https://api.github.com/repos/rustdesk/rustdesk-server-pro/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }' | sed 's/-.*//')
RDCURRENT=$(/usr/bin/rustdesk-server/hbbr --version | sed -r 's/hbbr (.*)-.*/\1/') RDCURRENT=$(/usr/bin/rustdesk-server/hbbr --version | sed -r 's/hbbr (.*)-.*/\1/')
if [ $RDLATEST == $RDCURRENT ]; then if [ $RDLATEST == $RDCURRENT ]; then
echo "Same version no need to update." echo "Same version, no need to update."
exit 0 exit 0
fi fi
@ -18,13 +18,15 @@ sleep 20
ARCH=$(uname -m) ARCH=$(uname -m)
# identify OS
# Identify OS
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
# freedesktop.org and systemd # freedesktop.org and systemd
. /etc/os-release . /etc/os-release
OS=$NAME OS=$NAME
VER=$VERSION_ID VER=$VERSION_ID
UPSTREAM_ID=${ID_LIKE,,} UPSTREAM_ID=${ID_LIKE,,}
# Fallback to ID_LIKE if ID was not 'ubuntu' or 'debian' # Fallback to ID_LIKE if ID was not 'ubuntu' or 'debian'
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)" UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
@ -40,13 +42,13 @@ elif [ -f /etc/lsb-release ]; then
OS=$DISTRIB_ID OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc. # Older Debian, Ubuntu, etc.
OS=Debian OS=Debian
VER=$(cat /etc/debian_version) VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then elif [ -f /etc/SuSE-release ]; then
# Older SuSE/etc. # Older SuSE, etc.
OS=SuSE OS=SuSE
VER=$(cat /etc/SuSe-release) VER=$(cat /etc/SuSE-release)
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc. # Older Red Hat, CentOS, etc.
OS=RedHat OS=RedHat
@ -58,7 +60,7 @@ else
fi fi
# output ebugging info if $DEBUG set # Output debugging info if $DEBUG set
if [ "$DEBUG" = "true" ]; then if [ "$DEBUG" = "true" ]; then
echo "OS: $OS" echo "OS: $OS"
echo "VER: $VER" echo "VER: $VER"
@ -68,7 +70,7 @@ fi
if ! [ -e /var/lib/rustdesk-server/ ]; then if ! [ -e /var/lib/rustdesk-server/ ]; then
echo "No directory /var/lib/rustdesk-server/ found. No update of rustdesk possible (use install.sh script ?) " echo "No directory /var/lib/rustdesk-server/ found. No update of RustDesk possible (use install.sh script?)"
exit 4 exit 4
else else
: :
@ -77,7 +79,7 @@ fi
cd /var/lib/rustdesk-server/ cd /var/lib/rustdesk-server/
rm -rf static/ rm -rf static/
echo "Upgrading Rustdesk Server" echo "Upgrading RustDesk Server"
if [ "${ARCH}" = "x86_64" ] ; then if [ "${ARCH}" = "x86_64" ] ; then
wget https://github.com/rustdesk/rustdesk-server-pro/releases/download/1.1.8/rustdesk-server-linux-amd64.zip wget https://github.com/rustdesk/rustdesk-server-pro/releases/download/1.1.8/rustdesk-server-linux-amd64.zip
unzip rustdesk-server-linux-amd64.zip unzip rustdesk-server-linux-amd64.zip
@ -112,7 +114,7 @@ sudo systemctl start rustdesk-hbbr.service
while ! [[ $CHECK_RUSTDESK_READY ]]; do while ! [[ $CHECK_RUSTDESK_READY ]]; do
CHECK_RUSTDESK_READY=$(sudo systemctl status rustdesk-hbbr.service | grep "Active: active (running)") CHECK_RUSTDESK_READY=$(sudo systemctl status rustdesk-hbbr.service | grep "Active: active (running)")
echo -ne "Rustdesk Relay not ready yet...${NC}\n" echo -ne "RustDesk Relay not ready yet...${NC}\n"
sleep 3 sleep 3
done done