udev: String substitutions can be done in ENV, too
[systemd_ALT.git] / units / meson-add-wants.sh
blob6d8da57402e4199518588e7f8e78b3937e48889f
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # shellcheck disable=SC2154,SC2174
4 set -eu
6 i=1
7 while [ $i -lt $# ] ; do
8 eval unitdir="\${$i}"
9 eval target="\${$((i + 1))}"
10 eval unit="\${$((i + 2))}"
12 if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
13 VERBOSE=""
14 else
15 VERBOSE="v"
18 case "$target" in
19 */?*) # a path, but not just a slash at the end
20 dir="${DESTDIR:-}${target}"
23 dir="${DESTDIR:-}${unitdir}/${target}"
25 esac
27 unitpath="${DESTDIR:-}${unitdir}/${unit}"
29 case "$target" in
30 */)
31 mkdir -${VERBOSE}p -m 0755 "$dir"
34 mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")"
36 esac
38 ln -${VERBOSE}fs --relative "$unitpath" "$dir"
40 i=$((i + 3))
41 done