Skip to content

Commit 30a398e

Browse files
authored
Makes external/git/clone.sh POSIX shell compatible (letoram#261)
1 parent d0e54e5 commit 30a398e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

external/git/clone.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# solution plucked from http://stackoverflow.com/questions/59895
4-
SOURCE="${BASH_SOURCE[0]}"
4+
SOURCE="$0"
55
while [ -h "$SOURCE" ]; do
66
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
77
SOURCE="$(readlink "$SOURCE")"
8-
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
8+
case $SOURCE in
9+
"/"*) true ;;
10+
*) SOURCE="$DIR/$SOURCE" ;;
11+
esac
912
done
1013
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
1114

15+
if [ ! -f "$DIR/clone.sh" ] || [ -h "$DIR/clone.sh" ]; then
16+
>&2 echo 'Could not resolve source directory, make sure to execute the source file instead of sourcing it'
17+
exit 1
18+
fi
19+
1220
git clone http://luajit.org/git/luajit-2.0.git "$DIR/luajit"
1321
git clone https://github.com/letoram/openal.git "$DIR/openal"
1422
git clone https://github.com/libuvc/libuvc.git "$DIR/libuvc"

0 commit comments

Comments
 (0)