Systemd/units/meson-add-wants.sh
Zbigniew Jędrzejewski-Szmek 2d9f0c6878 meson: add unit installation symlinks
This is the equivalent of $(SYSTEM_UNIT_ALIASES) and $(GENERAL_ALIASES)
in Makefile.am.

ninja-build uninstall does not remove the symlinks, see
https://github.com/mesonbuild/meson/issues/1602.
I don't consider this a blocker: after all either one installs into $DESTDIR,
where uninstallation doesn't make much sense, or into a real system, where a
successfull uninstallation would likely destroy the system.

v2:
- remove bashisms
- add various forgotten symlinks and fix service/timer/target confusions
2017-04-23 21:47:27 -04:00

28 lines
452 B
Bash

#!/bin/sh -e
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 -p -m 0755 "$dir"
;;
*)
mkdir -p -m 0755 "$(basename "$dir")"
;;
esac
ln -vfs --relative "$unitpath" "$dir"