summaryrefslogtreecommitdiff
path: root/tools/meson-make-symlink.sh
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2021-04-20 13:02:02 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2021-04-20 20:11:13 +0200
commit3b6fd3c1dea070cb1882b8810e18a45158a356f2 (patch)
tree1a42abd78e9acf4cf528c6e0e8998652c87ede9d /tools/meson-make-symlink.sh
parent437e889b18743ea4d594521829e43b6067ce9036 (diff)
downloadsystemd-3b6fd3c1dea070cb1882b8810e18a45158a356f2.tar.gz
tools: shellcheck-ify most of the tool scripts
Diffstat (limited to 'tools/meson-make-symlink.sh')
-rwxr-xr-xtools/meson-make-symlink.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh
index 96f5892281..653a73b0bd 100755
--- a/tools/meson-make-symlink.sh
+++ b/tools/meson-make-symlink.sh
@@ -2,6 +2,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
+SOURCE="${1:?}"
+TARGET="${2:?}"
+
if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
VERBOSE=""
else
@@ -11,9 +14,9 @@ fi
# this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory...
-mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$2")"
-if [ "$(dirname $1)" = . -o "$(dirname $1)" = .. ]; then
- ln -${VERBOSE}fs -T -- "$1" "${DESTDIR:-}$2"
+mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$TARGET")"
+if [ "$(dirname "$SOURCE")" = . ] || [ "$(dirname "$SOURCE")" = .. ]; then
+ ln -${VERBOSE}fs -T -- "$SOURCE" "${DESTDIR:-}$TARGET"
else
- ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2"
+ ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$SOURCE" "${DESTDIR:-}$TARGET"
fi