]> git.ipfire.org Git - thirdparty/systemd.git/blob - units/meson-add-wants.sh
test-string-util: add another test for stripping slashes
[thirdparty/systemd.git] / units / meson-add-wants.sh
1 #!/bin/sh -eu
2
3 unitdir="$1"
4 target="$2"
5 unit="$3"
6
7 case "$target" in
8 */?*) # a path, but not just a slash at the end
9 dir="${DESTDIR:-}${target}"
10 ;;
11 *)
12 dir="${DESTDIR:-}${unitdir}/${target}"
13 ;;
14 esac
15
16 unitpath="${DESTDIR:-}${unitdir}/${unit}"
17
18 case "$target" in
19 */)
20 mkdir -p -m 0755 "$dir"
21 ;;
22 *)
23 mkdir -p -m 0755 "$(basename "$dir")"
24 ;;
25 esac
26
27 ln -vfs --relative "$unitpath" "$dir"