summaryrefslogtreecommitdiffstats
path: root/units/meson-add-wants.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
commit2cb7e0aaedad73b076ea18c6900b0e86c5760d79 (patch)
treeda68ca54bb79f4080079bf0828acda937593a4e1 /units/meson-add-wants.sh
parentInitial commit. (diff)
downloadsystemd-2cb7e0aaedad73b076ea18c6900b0e86c5760d79.tar.xz
systemd-2cb7e0aaedad73b076ea18c6900b0e86c5760d79.zip
Adding upstream version 247.3.upstream/247.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xunits/meson-add-wants.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh
new file mode 100755
index 0000000..a483d75
--- /dev/null
+++ b/units/meson-add-wants.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+set -eu
+
+unitdir="$1"
+target="$2"
+unit="$3"
+
+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 -vp -m 0755 "$dir"
+ ;;
+ *)
+ mkdir -vp -m 0755 "$(dirname "$dir")"
+ ;;
+esac
+
+ln -vfs --relative "$unitpath" "$dir"