]>
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 | |
b884196c 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 | |
b884196c | 20 | */) |
3f491ccc | 21 | mkdir -vp -m 0755 "$dir" |
b884196c ZJS |
22 | ;; |
23 | *) | |
3f491ccc | 24 | mkdir -vp -m 0755 "$(dirname "$dir")" |
b884196c | 25 | ;; |
2d9f0c68 ZJS |
26 | esac |
27 | ||
28 | ln -vfs --relative "$unitpath" "$dir" |