Make realpath be more env agnostic 81/67781/2
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Wed, 19 Sep 2018 15:49:04 +0000 (11:49 -0400)
committerAlexis de Talhouët <alexis.de_talhouet@bell.ca>
Wed, 19 Sep 2018 15:55:24 +0000 (15:55 +0000)
realpath is not available on most Unix system.
readlink is more appropriate

Change-Id: Idbda95cad4ae6ac391a75d109743cc66ec5f6d41
Issue-ID: INT-666
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
version-manifest/src/main/scripts/update-oom-image-versions.sh

index 6342857..b17b46d 100755 (executable)
@@ -1,5 +1,18 @@
 #!/bin/bash
 
+realpath() {
+  OURPWD="$PWD"
+  cd "$(dirname "$1")"
+  LINK=$(readlink "$(basename "$1")")
+  while [ "$LINK" ]; do
+    cd "$(dirname "$LINK")"
+    LINK=$(readlink "$(basename "$1")")
+  done
+  REALPATH="$PWD/$(basename "$1")"
+  cd "$OURPWD"
+  echo "$REALPATH"
+}
+
 if [ "$#" -ne 2 ]; then
     echo This script updates OOM helm charts to use versions in docker-manifest.csv
     echo "$0 <docker-manifest.csv> <oom repo directory>"