]>
Commit | Line | Data |
---|---|---|
7629744a | 1 | #!/bin/sh |
2 | set -eu | |
2d9f0c68 ZJS |
3 | |
4 | unitdir="$1" | |
5 | target="$2" | |
6 | unit="$3" | |
7 | ||
8 | case "$target" in | |
cc5549ca ZJS |
9 | */?*) # a path, but not just a slash at the end |
10 | dir="${DESTDIR:-}${target}" | |
11 | ;; | |
12 | *) | |
13 | dir="${DESTDIR:-}${unitdir}/${target}" | |
14 | ;; | |
2d9f0c68 ZJS |
15 | esac |
16 | ||
dc25d2ad | 17 | unitpath="${DESTDIR:-}${unitdir}/${unit}" |
2d9f0c68 ZJS |
18 | |
19 | case "$target" in | |
cc5549ca ZJS |
20 | */) |
21 | mkdir -vp -m 0755 "$dir" | |
22 | ;; | |
23 | *) | |
24 | mkdir -vp -m 0755 "$(dirname "$dir")" | |
25 | ;; | |
2d9f0c68 ZJS |
26 | esac |
27 | ||
28 | ln -vfs --relative "$unitpath" "$dir" |