summaryrefslogtreecommitdiffstats
path: root/units/meson-add-wants.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
commitb750101eb236130cf056c675997decbac904cc49 (patch)
treea5df1a06754bdd014cb975c051c83b01c9a97532 /units/meson-add-wants.sh
parentInitial commit. (diff)
downloadsystemd-b750101eb236130cf056c675997decbac904cc49.tar.xz
systemd-b750101eb236130cf056c675997decbac904cc49.zip
Adding upstream version 252.22.upstream/252.22upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'units/meson-add-wants.sh')
-rwxr-xr-xunits/meson-add-wants.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh
new file mode 100755
index 0000000..6d8da57
--- /dev/null
+++ b/units/meson-add-wants.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# shellcheck disable=SC2154,SC2174
+set -eu
+
+i=1
+while [ $i -lt $# ] ; do
+ eval unitdir="\${$i}"
+ eval target="\${$((i + 1))}"
+ eval unit="\${$((i + 2))}"
+
+ if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
+ VERBOSE=""
+ else
+ VERBOSE="v"
+ fi
+
+ case "$target" in
+ */?*) # a path, but not just a slash at the end
+ dir="${DESTDIR:-}${target}"
+ ;;
+ *)
+ dir="${DESTDIR:-}${unitdir}/${target}"
+ ;;
+ esac
+
+ unitpath="${DESTDIR:-}${unitdir}/${unit}"
+
+ case "$target" in
+ */)
+ mkdir -${VERBOSE}p -m 0755 "$dir"
+ ;;
+ *)
+ mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")"
+ ;;
+ esac
+
+ ln -${VERBOSE}fs --relative "$unitpath" "$dir"
+
+ i=$((i + 3))
+done