Skip to content

Commit a7f4aa0

Browse files
properly resolving symlinks now
1 parent 7e30f25 commit a7f4aa0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

bin/selenium-background-run.bash

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
2-
DIR="$( cd -p "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2+
SOURCE="${BASH_SOURCE[0]}"
3+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
5+
SOURCE="$(readlink "$SOURCE")"
6+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
7+
done
8+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
39

410
echo '' > nohup.out
511
nohup $DIR/selenium-run.bash "$@" &

bin/selenium-run.bash

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/bin/bash
2-
DIR="$( cd -p "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2+
SOURCE="${BASH_SOURCE[0]}"
3+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
5+
SOURCE="$(readlink "$SOURCE")"
6+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
7+
done
8+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
39
cd $DIR/../binaries/
10+
if [[ $? != 0 ]]
11+
then
12+
echo "Failed cd-ing into the the binaries folder, aborting"
13+
exit 1
14+
fi
415
MAJOR_VERSION=2.44
516
VERSION=${MAJOR_VERSION}.0
617
JAR_FILE=selenium-server-standalone-${VERSION}.jar

0 commit comments

Comments
 (0)