]> git.proxmox.com Git - systemd.git/blame - units/meson-add-wants.sh
Fix boot-and-services autopkgtest
[systemd.git] / units / meson-add-wants.sh
CommitLineData
1d42b86d 1#!/bin/sh
3a6ce677 2# SPDX-License-Identifier: LGPL-2.1-or-later
ea0999c9 3# shellcheck disable=SC2154,SC2174
1d42b86d 4set -eu
81c58355 5
3a6ce677
BR
6i=1
7while [ $i -lt $# ] ; do
8 eval unitdir="\${$i}"
9 eval target="\${$((i + 1))}"
10 eval unit="\${$((i + 2))}"
81c58355 11
3a6ce677
BR
12 if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
13 VERBOSE=""
14 else
15 VERBOSE="v"
16 fi
81c58355 17
3a6ce677
BR
18 case "$target" in
19 */?*) # a path, but not just a slash at the end
20 dir="${DESTDIR:-}${target}"
21 ;;
22 *)
23 dir="${DESTDIR:-}${unitdir}/${target}"
24 ;;
25 esac
81c58355 26
3a6ce677 27 unitpath="${DESTDIR:-}${unitdir}/${unit}"
81c58355 28
3a6ce677
BR
29 case "$target" in
30 */)
31 mkdir -${VERBOSE}p -m 0755 "$dir"
32 ;;
33 *)
34 mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")"
35 ;;
36 esac
37
38 ln -${VERBOSE}fs --relative "$unitpath" "$dir"
39
40 i=$((i + 3))
41done