aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-05 12:49:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-05 12:49:45 +0200
commitbf4a03ac20d868b347be8174fe4edd64f77d6645 (patch)
tree2e108e9c13109c839d859e3e07a840203f5e51fc
parent262f05d648c9fc300ffd980cc848b03670d7469c (diff)
Revert "Detect in build.sh if installation directory is inside source"
It is more robust to support installing inside source (the following commit).
-rw-r--r--build.sh.in29
1 files changed, 9 insertions, 20 deletions
diff --git a/build.sh.in b/build.sh.in
index 3dfb5be..f9279b7 100644
--- a/build.sh.in
+++ b/build.sh.in
@@ -461,30 +461,19 @@ if test -z "$idir"; then
if test -z "$sudo"; then
sudo="sudo"
fi
-else
- if test -n "$(echo "$idir" | sed -n 's#^[^/].*$#true#p')"; then
- if ! command -v realpath >/dev/null 2>&1; then
- diag "error: unable to execute realpath: command not found"
- diag " info: specify absolute installation directory path"
- exit 1
- fi
+elif test -n "$(echo "$idir" | sed -n 's#^[^/].*$#true#p')"; then
- # Don't resolve symlinks and allow non-existent path components.
- #
- if ! idir="$(realpath -s -m "$idir" 2>/dev/null)"; then
- diag "error: realpath does not recognize -s -m"
- diag " info: specify absolute installation directory path"
- exit 1
- fi
+ if ! command -v realpath >/dev/null 2>&1; then
+ diag "error: unable to execute realpath: command not found"
+ diag " info: specify absolute installation directory path"
+ exit 1
fi
- # Check that it's not inside the build directory (we assume nobody
- # is going to specify a path containing `#` or other special sed
- # characters).
+ # Don't resolve symlinks and allow non-existent path components.
#
- eowd="$(echo "$owd" | sed 's%\([#.*^$\\[\]]\)%\\\1%g')"
- if test -n "$(echo "$idir/" | sed -n "s#^$eowd/.*#true#p")"; then
- diag "error: installation directory is inside current directory"
+ if ! idir="$(realpath -s -m "$idir" 2>/dev/null)"; then
+ diag "error: realpath does not recognize -s -m"
+ diag " info: specify absolute installation directory path"
exit 1
fi
fi