diff options
Diffstat (limited to 'plugins/meson-add-wants.sh')
-rwxr-xr-x | plugins/meson-add-wants.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/meson-add-wants.sh b/plugins/meson-add-wants.sh new file mode 100755 index 0000000..c33d1b4 --- /dev/null +++ b/plugins/meson-add-wants.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -eu + +# Script copied from systemd + +unitdir="$1" +target="$2" +unit="$3" + +case "$target" in + */?*) # a path, but not just a slash at the end + dir="${DESTDIR:-}${target}" + ;; + *) + dir="${DESTDIR:-}${unitdir}/${target}" + ;; +esac + +unitpath="${DESTDIR:-}${unitdir}/${unit}" + +case "$target" in + */) + mkdir -vp -m 0755 "$dir" + ;; + *) + mkdir -vp -m 0755 "$(dirname "$dir")" + ;; +esac + +ln -vfs --relative "$unitpath" "$dir" |