]>
Commit | Line | Data |
---|---|---|
7629744a | 1 | #!/bin/sh |
9ee03516 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
7629744a | 3 | set -eu |
2d9f0c68 | 4 | |
4ad303fd DDM |
5 | i=1 |
6 | while [ $i -lt $# ] ; do | |
7 | eval unitdir="\${$i}" | |
8 | eval target="\${$((i + 1))}" | |
9 | eval unit="\${$((i + 2))}" | |
2d9f0c68 | 10 | |
4ad303fd DDM |
11 | if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then |
12 | VERBOSE="" | |
13 | else | |
14 | VERBOSE="v" | |
15 | fi | |
09422f9a | 16 | |
4ad303fd DDM |
17 | case "$target" in |
18 | */?*) # a path, but not just a slash at the end | |
19 | dir="${DESTDIR:-}${target}" | |
20 | ;; | |
21 | *) | |
22 | dir="${DESTDIR:-}${unitdir}/${target}" | |
23 | ;; | |
24 | esac | |
2d9f0c68 | 25 | |
4ad303fd | 26 | unitpath="${DESTDIR:-}${unitdir}/${unit}" |
2d9f0c68 | 27 | |
4ad303fd DDM |
28 | case "$target" in |
29 | */) | |
30 | mkdir -${VERBOSE}p -m 0755 "$dir" | |
31 | ;; | |
32 | *) | |
33 | mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")" | |
34 | ;; | |
35 | esac | |
2d9f0c68 | 36 | |
4ad303fd DDM |
37 | ln -${VERBOSE}fs --relative "$unitpath" "$dir" |
38 | ||
39 | i=$((i + 3)) | |
40 | done |