# systemd specific functions # automatical inherit systemd.minc # this will provide the service management functions INHERITS+=" systemd" DEPEND="${DEPEND} >= sys-apps/systemd-230" SDEPEND="${SDEPEND} >= dev-util/pkgconfig-0.27" sminclude mtools mget-systemd-conf-dir() { pkg-config systemd --variable=systemdsystemconfdir } mget-systemd-user-conf-dir() { pkg-config systemd --variable=systemduserconfdir } mget-systemd-unit-dir() { pkg-config systemd --variable=systemdsystemunitdir } mget-systemd-user-unit-dir() { pkg-config systemd --variable=systemduserunitdir } mget-systemd-util-dir() { pkg-config systemd --variable=systemdutildir } mget-systemd-preset-dir() { pkg-config systemd --variable=systemdsystempresetdir } mget-systemd-tmpfilesdir() { pkg-config systemd --variable=tmpfilesdir } mget-systemd-sysusersdir() { pkg-config systemd --variable=sysusersdir } mget-systemd-sysctldir() { pkg-config systemd --variable=sysctldir } # installs systemd units # minstallunit /path/to/unit-file {destfilename} minstallunit() { local unit local file local systemdunitdir="$(mget-systemd-unit-dir)" [[ -z "$1" ]] && die "No unit given" # if no fullpath given use file from sourcedir if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] then file="${SOURCEDIR}/$(mpname)/$1" else file="$1" fi if [[ -n "$2" ]] then unit="$2" else unit="$(basename ${file})" fi # needed directory minstalldir ${systemdunitdir} || die # install our initscript minstallfile ${file} ${systemdunitdir}/${unit} || die } # installs systemd tmp configs to /etc/tmpfiles.d # minstalltmp /path/to/tmpdfile {destfilename} minstalltmp() { local tmpdfile local file local tmpfilesdir="$(mget-systemd-tmpfilesdir)" [[ -z "$1" ]] && die "No tmpd file given" # if no fullpath given use file from sourcedir if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] then file="${SOURCEDIR}/$(mpname)/$1" else file="$1" fi if [[ -n "$2" ]] then tmpdfile="$2" else tmpdfile="$(basename ${file})" fi # needed directory minstalldir ${tmpfilesdir} || die # install our tmpdfile minstallfile ${file} ${tmpfilesdir}/${tmpdfile} || die }