From 30c3a74aa8a21a2d6309e9674855f4422b5730eb Mon Sep 17 00:00:00 2001 From: carefreepineapple <41390136+carefreepineapple@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:47:02 -0400 Subject: [PATCH 1/6] Update linuxclientinstall.sh --- linuxclientinstall.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index 3cdf6ad..c406eac 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -2,7 +2,7 @@ uname=$(whoami) admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c8) - +architecture=$(arch) # identify OS if [ -f /etc/os-release ]; then @@ -50,7 +50,15 @@ fi lversion=$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }') echo "Installing Rustdesk" -if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then +if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then + if [[ "$architecture" != @("x86_64"|"aarch64") ]]; then + echo "Unsupported Architecture" + fi + sudo add-apt-repository -y universe + sudo apt install -y libxdo3 curl libva-drm2 libva-x11-2 + wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-$architecture.deb + sudo apt install -fy ./rustdesk-$lversion-$architecture.deb +elif [ "${ID}" = "debian" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "debian" ]; then wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-x86_64.deb sudo apt install -fy ./rustdesk-$lversion-x86_64.deb elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] ; then From 8deb9876f207b35e8001e3176f4040ca9e69de37 Mon Sep 17 00:00:00 2001 From: carefreepineapple <41390136+carefreepineapple@users.noreply.github.com> Date: Thu, 10 Aug 2023 19:25:07 -0400 Subject: [PATCH 2/6] Update linuxclientinstall.sh --- linuxclientinstall.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index c406eac..852993e 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -53,6 +53,7 @@ echo "Installing Rustdesk" if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then if [[ "$architecture" != @("x86_64"|"aarch64") ]]; then echo "Unsupported Architecture" + exit 1 fi sudo add-apt-repository -y universe sudo apt install -y libxdo3 curl libva-drm2 libva-x11-2 From 94fb5b17501bfa1737c671adb4562db62e0516f9 Mon Sep 17 00:00:00 2001 From: carefreepineapple Date: Thu, 10 Aug 2023 19:29:05 -0400 Subject: [PATCH 3/6] encapsulating repo add and dependency installation within architecture identification --- linuxclientinstall.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index 852993e..087c014 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -55,8 +55,10 @@ if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then echo "Unsupported Architecture" exit 1 fi - sudo add-apt-repository -y universe - sudo apt install -y libxdo3 curl libva-drm2 libva-x11-2 + if [ "$architecture" = "aarch64" ]; then + sudo add-apt-repository -y universe + sudo apt install -y libxdo3 curl libva-drm2 libva-x11-2 + fi wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-$architecture.deb sudo apt install -fy ./rustdesk-$lversion-$architecture.deb elif [ "${ID}" = "debian" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "debian" ]; then From 920d3274648e77d94126a92512d16da26b987e8f Mon Sep 17 00:00:00 2001 From: carefreepineapple Date: Thu, 10 Aug 2023 19:40:04 -0400 Subject: [PATCH 4/6] adding check for lversion var to determine if empty when installing aarch64 --- linuxclientinstall.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index 087c014..85ffd3f 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -58,6 +58,9 @@ if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then if [ "$architecture" = "aarch64" ]; then sudo add-apt-repository -y universe sudo apt install -y libxdo3 curl libva-drm2 libva-x11-2 + if [ -z "$lversion" ]; then + lversion=$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }') + fi fi wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-$architecture.deb sudo apt install -fy ./rustdesk-$lversion-$architecture.deb From e164d7767417f8ae17059151f87abdf8957d17d3 Mon Sep 17 00:00:00 2001 From: carefreepineapple Date: Thu, 10 Aug 2023 19:45:50 -0400 Subject: [PATCH 5/6] adding check for curl before trying to set lversion var --- linuxclientinstall.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index 85ffd3f..0e73e80 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -47,8 +47,9 @@ else fi # Install Rustdesk -lversion=$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }') - +if command -v curl > /dev/null; then + lversion=$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }') +fi echo "Installing Rustdesk" if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then if [[ "$architecture" != @("x86_64"|"aarch64") ]]; then From 18c9af7299431a8b1f7d013bc8930953530f1f76 Mon Sep 17 00:00:00 2001 From: carefreepineapple Date: Fri, 11 Aug 2023 00:23:43 -0400 Subject: [PATCH 6/6] adding a sleep after installation to let the package manager finish and avoid errors. --- linuxclientinstall.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/linuxclientinstall.sh b/linuxclientinstall.sh index 0e73e80..2f681b1 100644 --- a/linuxclientinstall.sh +++ b/linuxclientinstall.sh @@ -3,6 +3,7 @@ uname=$(whoami) admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c8) architecture=$(arch) +bpwd=$(pwd) # identify OS if [ -f /etc/os-release ]; then @@ -63,14 +64,14 @@ if [ "$OS" = "Ubuntu" ] || [ "${UPSTREAM_ID}" = "ubuntu" ]; then lversion=$(curl https://api.github.com/repos/rustdesk/rustdesk/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }') fi fi - wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-$architecture.deb - sudo apt install -fy ./rustdesk-$lversion-$architecture.deb + wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-$architecture.deb --output-document="$bpwd/rustdesk-$lversion-$architecture.deb" + sudo apt install -fy $bpwd/rustdesk-$lversion-$architecture.deb elif [ "${ID}" = "debian" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "debian" ]; then - wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-x86_64.deb - sudo apt install -fy ./rustdesk-$lversion-x86_64.deb + wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-x86_64.deb --output-document="$bpwd/rustdesk-$lversion-x86_64.deb" + sudo apt install -fy $bpwd/rustdesk-$lversion-x86_64.deb elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "$OS" = "Fedora Linux" ] || [ "${UPSTREAM_ID}" = "rhel" ] ; then - wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-0.x86_64.rpm - sudo yum localinstall ./rustdesk-$lversion-0.x86_64.rpm + wget https://github.com/rustdesk/rustdesk/releases/download/$lversion/rustdesk-$lversion-0.x86_64.rpm --output-document="$bpwd/rustdesk-$lversion-0.x86_64.rpm" + sudo yum localinstall $bpwd/rustdesk-$lversion-0.x86_64.rpm else echo "Unsupported OS" # here you could ask the user for permission to try and install anyway @@ -78,7 +79,8 @@ else # if they say no, exit the script exit 1 fi - +# Sleeping to let the package manager finish installation. If this does not complete before trying to run rustdesk, it can cause a panick citing an inability to find the files. +sleep 5 rustdesk --password ${admintoken} sudo pkill -f "rustdesk"