From 2b1ca0eb0a82e9d9f88c3c77ceffa2b60d49d7ec Mon Sep 17 00:00:00 2001
From: Dirk Sarpe <dirk.sarpe@idiv.de>
Date: Fri, 27 Sep 2019 15:50:45 +0200
Subject: [PATCH] adapt rstudio version check to changed dl-website

---
 rstudio_version_check.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/rstudio_version_check.sh b/rstudio_version_check.sh
index 75d333b..85b56f0 100755
--- a/rstudio_version_check.sh
+++ b/rstudio_version_check.sh
@@ -2,23 +2,23 @@
 # check for new rstudio and download it if necessary
 
 set -e
-
-rawstring=$(curl -s https://www.rstudio.com/products/rstudio/download-server/ |grep -o "wget.*amd64.deb")
+ubuntudlversion=trusty
+rawstring=$(curl -s https://rstudio.com/products/rstudio/download-server/debian-ubuntu/ |
+  grep -o -e "wget https:\/\/.*server\/${ubuntudlversion}.*\/rstudio-server-[0-9.]\+-amd64.deb")
 prefix="$"
 suffix="<br />"
 noprefix=${rawstring#$prefix}
 nosuffix=${noprefix%$suffix}
-dlcommand="$(echo $nosuffix -q -P /home/monitoring/)"
+dlcommand="$nosuffix -q -P /home/monitoring/"
 cur_version=$(rstudio-server version)
-avail_version="$(echo $dlcommand | cut -d "-" -f 3)"
+avail_version=$(cut -d "-" -f 3 <<< "$dlcommand")
 if [ "$avail_version" == "$cur_version" ]
   then
     echo "RStudio up to date."
   else
-    if [ ! -e /home/monitoring/rstudio-server-${avail_version}-amd64.deb ]
+    if [ ! -e /home/monitoring/rstudio-server-"${avail_version}"-amd64.deb ]
       then
-        eval $dlcommand
+        eval "$dlcommand"
     fi
     echo "RStudio version $avail_version available (in use $cur_version)"
 fi
-
-- 
GitLab