|
3 | 3 | # Create configure and makefile stuff... |
4 | 4 | # |
5 | 5 |
|
| 6 | +# Check environment |
| 7 | +if [ -n "$WSL_DISTRO_NAME" ]; then |
| 8 | + # we found a non-blank WSL environment distro name |
| 9 | + current_path="$(pwd)" |
| 10 | + pattern="/mnt/?" |
| 11 | + if [ "$(echo "$current_path" | grep -E "^$pattern")" ]; then |
| 12 | + # if we are in WSL and shared Windows file system, 'ln' does not work. |
| 13 | + no_links=true |
| 14 | + else |
| 15 | + no_links= |
| 16 | + fi |
| 17 | +fi |
| 18 | + |
6 | 19 | # Git hooks should come before autoreconf. |
7 | 20 | if [ -d .git ]; then |
8 | 21 | if [ ! -d .git/hooks ]; then |
9 | 22 | mkdir .git/hooks || exit $? |
10 | 23 | fi |
11 | | - if [ ! -e .git/hooks/pre-commit ]; then |
12 | | - ln -s ../../pre-commit.sh .git/hooks/pre-commit || exit $? |
13 | | - fi |
14 | | - if [ ! -e .git/hooks/pre-push ]; then |
15 | | - ln -s ../../pre-push.sh .git/hooks/pre-push || exit $? |
| 24 | + |
| 25 | + if [ -n "$no_links" ]; then |
| 26 | + echo "Linux ln does not work on shared Windows file system in WSL." |
| 27 | + if [ ! -e .git/hooks/pre-commit ]; then |
| 28 | + echo "The pre-commit.sh file will not be copied to .git/hooks/pre-commit" |
| 29 | + # shell scripts do not work on Windows; TODO create equivalent batch file |
| 30 | + # cp ./pre-commit.sh .git/hooks/pre-commit || exit $? |
| 31 | + fi |
| 32 | + if [ ! -e .git/hooks/pre-push ]; then |
| 33 | + echo "The pre-push.sh file will not be copied to .git/hooks/pre-commit" |
| 34 | + # shell scripts do not work on Windows; TODO create equivalent batch file |
| 35 | + # cp ./pre-push.sh .git/hooks/pre-push || exit $? |
| 36 | + fi |
| 37 | + else |
| 38 | + if [ ! -e .git/hooks/pre-commit ]; then |
| 39 | + ln -s ../../pre-commit.sh .git/hooks/pre-commit || exit $? |
| 40 | + fi |
| 41 | + if [ ! -e .git/hooks/pre-push ]; then |
| 42 | + ln -s ../../pre-push.sh .git/hooks/pre-push || exit $? |
| 43 | + fi |
16 | 44 | fi |
17 | 45 | fi |
18 | 46 |
|
|
0 commit comments