Annotation of /trunk/include/systemd.sminc
Parent Directory | Revision Log
Revision 19668 -
(hide annotations)
(download)
Wed Oct 9 13:09:29 2013 UTC (11 years ago) by niro
File size: 1824 byte(s)
Wed Oct 9 13:09:29 2013 UTC (11 years ago) by niro
File size: 1824 byte(s)
-split udev, hal, systemd and sysvinit functions into seperate includes and use pkgconfig if possible
1 | niro | 19668 | # 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 | >= dev-util/pkgconfig-0.27" | ||
12 | |||
13 | sminclude mtools | ||
14 | |||
15 | mget-systemd-conf-dir() | ||
16 | { | ||
17 | pkg-config systemd --variable=systemdsystemconfdir | ||
18 | } | ||
19 | |||
20 | mget-systemd-user-conf-dir() | ||
21 | { | ||
22 | pkg-config systemd --variable=systemduserconfdir | ||
23 | } | ||
24 | |||
25 | mget-systemd-unit-dir() | ||
26 | { | ||
27 | pkg-config systemd --variable=systemdsystemunitdir | ||
28 | } | ||
29 | |||
30 | mget-systemd-util-dir() | ||
31 | { | ||
32 | pkg-config systemd --variable=systemdutildir | ||
33 | } | ||
34 | |||
35 | mget-systemd-preset-dir() | ||
36 | { | ||
37 | pkg-config systemd --variable=systemdsystempresetdir | ||
38 | } | ||
39 | |||
40 | # installs systemd units | ||
41 | # minstallunit /path/to/unit-file {destfilename} | ||
42 | minstallunit() | ||
43 | { | ||
44 | local unit | ||
45 | local file | ||
46 | local systemdunitdir="$(mget-systemd-unit-dir)" | ||
47 | |||
48 | [[ -z "$1" ]] && die "No unit given" | ||
49 | |||
50 | # if no fullpath given use file from sourcedir | ||
51 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
52 | then | ||
53 | file="${SOURCEDIR}/$(mpname)/$1" | ||
54 | else | ||
55 | file="$1" | ||
56 | fi | ||
57 | |||
58 | if [[ -n "$2" ]] | ||
59 | then | ||
60 | unit="$2" | ||
61 | else | ||
62 | unit="$(basename ${file})" | ||
63 | fi | ||
64 | |||
65 | # needed directory | ||
66 | minstalldir ${systemdunitdir} || die | ||
67 | |||
68 | # install our initscript | ||
69 | minstallfile ${file} ${systemdunitdir}/${unit} || die | ||
70 | } | ||
71 | |||
72 | # installs systemd tmp configs to /etc/tmpfiles.d | ||
73 | # minstalltmp /path/to/tmpdfile {destfilename} | ||
74 | minstalltmp() | ||
75 | { | ||
76 | local tmpdfile | ||
77 | local file | ||
78 | |||
79 | [[ -z "$1" ]] && die "No tmpd file given" | ||
80 | |||
81 | # if no fullpath given use file from sourcedir | ||
82 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
83 | then | ||
84 | file="${SOURCEDIR}/$(mpname)/$1" | ||
85 | else | ||
86 | file="$1" | ||
87 | fi | ||
88 | |||
89 | if [[ -n "$2" ]] | ||
90 | then | ||
91 | tmpdfile="$2" | ||
92 | else | ||
93 | tmpdfile="$(basename ${file})" | ||
94 | fi | ||
95 | |||
96 | # needed directory | ||
97 | minstalldir /etc/tmpfiles.d || die | ||
98 | |||
99 | # install our tmpdfile | ||
100 | minstallfile ${file} /etc/tmpfiles.d/${tmpdfile} || die | ||
101 | } |