Annotation of /smage/trunk/include/systemd.sminc
Parent Directory | Revision Log
Revision 13777 -
(hide annotations)
(download)
Wed Oct 30 12:46:36 2019 UTC (4 years, 10 months ago) by niro
File size: 2205 byte(s)
Wed Oct 30 12:46:36 2019 UTC (4 years, 10 months ago) by niro
File size: 2205 byte(s)
-sync with upstream
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 | niro | 11796 | >= sys-apps/systemd-230" |
9 | niro | 5218 | |
10 | SDEPEND="${SDEPEND} | ||
11 | niro | 11796 | >= sys-apps/systemd-dev-230 |
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 | niro | 13777 | mget-systemd-user-unit-dir() |
32 | { | ||
33 | pkg-config systemd --variable=systemduserunitdir | ||
34 | } | ||
35 | |||
36 | niro | 5218 | mget-systemd-util-dir() |
37 | { | ||
38 | pkg-config systemd --variable=systemdutildir | ||
39 | } | ||
40 | |||
41 | mget-systemd-preset-dir() | ||
42 | { | ||
43 | pkg-config systemd --variable=systemdsystempresetdir | ||
44 | } | ||
45 | |||
46 | niro | 11796 | mget-systemd-tmpfilesdir() |
47 | { | ||
48 | pkg-config systemd --variable=tmpfilesdir | ||
49 | } | ||
50 | |||
51 | mget-systemd-sysusersdir() | ||
52 | { | ||
53 | pkg-config systemd --variable=sysusersdir | ||
54 | } | ||
55 | |||
56 | mget-systemd-sysctldir() | ||
57 | { | ||
58 | pkg-config systemd --variable=sysctldir | ||
59 | } | ||
60 | |||
61 | niro | 5218 | # installs systemd units |
62 | # minstallunit /path/to/unit-file {destfilename} | ||
63 | minstallunit() | ||
64 | { | ||
65 | local unit | ||
66 | local file | ||
67 | local systemdunitdir="$(mget-systemd-unit-dir)" | ||
68 | |||
69 | [[ -z "$1" ]] && die "No unit given" | ||
70 | |||
71 | # if no fullpath given use file from sourcedir | ||
72 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
73 | then | ||
74 | file="${SOURCEDIR}/$(mpname)/$1" | ||
75 | else | ||
76 | file="$1" | ||
77 | fi | ||
78 | |||
79 | if [[ -n "$2" ]] | ||
80 | then | ||
81 | unit="$2" | ||
82 | else | ||
83 | unit="$(basename ${file})" | ||
84 | fi | ||
85 | |||
86 | # needed directory | ||
87 | minstalldir ${systemdunitdir} || die | ||
88 | |||
89 | # install our initscript | ||
90 | minstallfile ${file} ${systemdunitdir}/${unit} || die | ||
91 | } | ||
92 | |||
93 | # installs systemd tmp configs to /etc/tmpfiles.d | ||
94 | # minstalltmp /path/to/tmpdfile {destfilename} | ||
95 | minstalltmp() | ||
96 | { | ||
97 | local tmpdfile | ||
98 | local file | ||
99 | niro | 11796 | local tmpfilesdir="$(mget-systemd-tmpfilesdir)" |
100 | niro | 5218 | |
101 | [[ -z "$1" ]] && die "No tmpd file given" | ||
102 | |||
103 | # if no fullpath given use file from sourcedir | ||
104 | if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]] | ||
105 | then | ||
106 | file="${SOURCEDIR}/$(mpname)/$1" | ||
107 | else | ||
108 | file="$1" | ||
109 | fi | ||
110 | |||
111 | if [[ -n "$2" ]] | ||
112 | then | ||
113 | tmpdfile="$2" | ||
114 | else | ||
115 | tmpdfile="$(basename ${file})" | ||
116 | fi | ||
117 | |||
118 | # needed directory | ||
119 | niro | 11796 | minstalldir ${tmpfilesdir} || die |
120 | niro | 5218 | |
121 | # install our tmpdfile | ||
122 | niro | 11796 | minstallfile ${file} ${tmpfilesdir}/${tmpdfile} || die |
123 | niro | 5218 | } |