Annotation of /smage/trunk/include/systemd.sminc
Parent Directory | Revision Log
Revision 5903 -
(hide annotations)
(download)
Wed Mar 18 09:52:05 2015 UTC (9 years, 6 months ago) by niro
File size: 1853 byte(s)
Wed Mar 18 09:52:05 2015 UTC (9 years, 6 months ago) by niro
File size: 1853 byte(s)
-honor -dev packages
1 | niro | 5218 | # systemd specific functions |
2 | |||
3 | # automatical inherit systemd.minc | ||
4 | # this will provide the service management functions | ||
5 | INHERITS+=" systemd" | ||
6 | |||
7 | DEPEND="${DEPEND} | ||
8 | >= sys-apps/systemd-208" | ||
9 | |||
10 | SDEPEND="${SDEPEND} | ||
11 | niro | 5903 | >= sys-apps/systemd-dev-208 |
12 | niro | 5218 | >= dev-util/pkgconfig-0.27" |
13 | |||
14 | sminclude mtools | ||
15 | |||
16 | mget-systemd-conf-dir() | ||
17 | { | ||
18 | pkg-config systemd --variable=systemdsystemconfdir | ||
19 | } | ||
20 | |||
21 | mget-systemd-user-conf-dir() | ||
22 | { | ||
23 | pkg-config systemd --variable=systemduserconfdir | ||
24 | } | ||
25 | |||
26 | mget-systemd-unit-dir() | ||
27 | { | ||
28 | pkg-config systemd --variable=systemdsystemunitdir | ||
29 | } | ||
30 | |||
31 | mget-systemd-util-dir() | ||
32 | { | ||
33 | pkg-config systemd --variable=systemdutildir | ||
34 | } | ||
35 | |||
36 | mget-systemd-preset-dir() | ||
37 | { | ||
38 | pkg-config systemd --variable=systemdsystempresetdir | ||
39 | } | ||
40 | |||
41 | # installs systemd units | ||
42 | # minstallunit /path/to/unit-file {destfilename} | ||
43 | minstallunit() | ||
44 | { | ||
45 | local unit | ||
46 | local file | ||
47 | local systemdunitdir="$(mget-systemd-unit-dir)" | ||
48 | |||
49 | [[ -z "$1" ]] && die "No unit given" | ||
50 | |||
51 | # if no fullpath given use file from sourcedir | ||
52 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
53 | then | ||
54 | file="${SOURCEDIR}/$(mpname)/$1" | ||
55 | else | ||
56 | file="$1" | ||
57 | fi | ||
58 | |||
59 | if [[ -n "$2" ]] | ||
60 | then | ||
61 | unit="$2" | ||
62 | else | ||
63 | unit="$(basename ${file})" | ||
64 | fi | ||
65 | |||
66 | # needed directory | ||
67 | minstalldir ${systemdunitdir} || die | ||
68 | |||
69 | # install our initscript | ||
70 | minstallfile ${file} ${systemdunitdir}/${unit} || die | ||
71 | } | ||
72 | |||
73 | # installs systemd tmp configs to /etc/tmpfiles.d | ||
74 | # minstalltmp /path/to/tmpdfile {destfilename} | ||
75 | minstalltmp() | ||
76 | { | ||
77 | local tmpdfile | ||
78 | local file | ||
79 | |||
80 | [[ -z "$1" ]] && die "No tmpd file given" | ||
81 | |||
82 | # if no fullpath given use file from sourcedir | ||
83 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
84 | then | ||
85 | file="${SOURCEDIR}/$(mpname)/$1" | ||
86 | else | ||
87 | file="$1" | ||
88 | fi | ||
89 | |||
90 | if [[ -n "$2" ]] | ||
91 | then | ||
92 | tmpdfile="$2" | ||
93 | else | ||
94 | tmpdfile="$(basename ${file})" | ||
95 | fi | ||
96 | |||
97 | # needed directory | ||
98 | minstalldir /etc/tmpfiles.d || die | ||
99 | |||
100 | # install our tmpdfile | ||
101 | minstallfile ${file} /etc/tmpfiles.d/${tmpdfile} || die | ||
102 | } |