Annotation of /trunk/include/systemd.sminc
Parent Directory | Revision Log
Revision 31493 -
(hide annotations)
(download)
Wed Aug 8 13:38:20 2018 UTC (6 years, 1 month ago) by niro
File size: 2092 byte(s)
Wed Aug 8 13:38:20 2018 UTC (6 years, 1 month ago) by niro
File size: 2092 byte(s)
-added mget-systemd-tmpfilesdir(), mget-systemd-sysusersdir(), mget-systemd-sysctldir() functions and use mget-systemd-tmpfilesdir() in the minstalltmp() function
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 | niro | 31493 | >= sys-apps/systemd-230" |
9 | niro | 19668 | |
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 | niro | 31493 | mget-systemd-tmpfilesdir() |
41 | { | ||
42 | pkg-config systemd --variable=tmpfilesdir | ||
43 | } | ||
44 | |||
45 | mget-systemd-sysusersdir() | ||
46 | { | ||
47 | pkg-config systemd --variable=sysusersdir | ||
48 | } | ||
49 | |||
50 | mget-systemd-sysctldir() | ||
51 | { | ||
52 | pkg-config systemd --variable=sysctldir | ||
53 | } | ||
54 | |||
55 | niro | 19668 | # installs systemd units |
56 | # minstallunit /path/to/unit-file {destfilename} | ||
57 | minstallunit() | ||
58 | { | ||
59 | local unit | ||
60 | local file | ||
61 | local systemdunitdir="$(mget-systemd-unit-dir)" | ||
62 | |||
63 | [[ -z "$1" ]] && die "No unit given" | ||
64 | |||
65 | # if no fullpath given use file from sourcedir | ||
66 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
67 | then | ||
68 | file="${SOURCEDIR}/$(mpname)/$1" | ||
69 | else | ||
70 | file="$1" | ||
71 | fi | ||
72 | |||
73 | if [[ -n "$2" ]] | ||
74 | then | ||
75 | unit="$2" | ||
76 | else | ||
77 | unit="$(basename ${file})" | ||
78 | fi | ||
79 | |||
80 | # needed directory | ||
81 | minstalldir ${systemdunitdir} || die | ||
82 | |||
83 | # install our initscript | ||
84 | minstallfile ${file} ${systemdunitdir}/${unit} || die | ||
85 | } | ||
86 | |||
87 | # installs systemd tmp configs to /etc/tmpfiles.d | ||
88 | # minstalltmp /path/to/tmpdfile {destfilename} | ||
89 | minstalltmp() | ||
90 | { | ||
91 | local tmpdfile | ||
92 | local file | ||
93 | niro | 31493 | local tmpfilesdir="$(mget-systemd-tmpfilesdir)" |
94 | niro | 19668 | |
95 | [[ -z "$1" ]] && die "No tmpd file given" | ||
96 | |||
97 | # if no fullpath given use file from sourcedir | ||
98 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
99 | then | ||
100 | file="${SOURCEDIR}/$(mpname)/$1" | ||
101 | else | ||
102 | file="$1" | ||
103 | fi | ||
104 | |||
105 | if [[ -n "$2" ]] | ||
106 | then | ||
107 | tmpdfile="$2" | ||
108 | else | ||
109 | tmpdfile="$(basename ${file})" | ||
110 | fi | ||
111 | |||
112 | # needed directory | ||
113 | niro | 31493 | minstalldir ${tmpfilesdir} || die |
114 | niro | 19668 | |
115 | # install our tmpdfile | ||
116 | niro | 31493 | minstallfile ${file} ${tmpfilesdir}/${tmpdfile} || die |
117 | niro | 19668 | } |