Contents of /smage/tags/alx-0_7_3/include/systemd.sminc
Parent Directory | Revision Log
Revision 15266 -
(show annotations)
(download)
Fri Aug 7 07:54:23 2020 UTC (4 years, 1 month ago) by niro
File size: 2205 byte(s)
Fri Aug 7 07:54:23 2020 UTC (4 years, 1 month ago) by niro
File size: 2205 byte(s)
tagged 'alx-0_7_3'
1 | # 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-230" |
9 | |
10 | SDEPEND="${SDEPEND} |
11 | >= sys-apps/systemd-dev-230 |
12 | >= 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-user-unit-dir() |
32 | { |
33 | pkg-config systemd --variable=systemduserunitdir |
34 | } |
35 | |
36 | 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 | 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 | # 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 | local tmpfilesdir="$(mget-systemd-tmpfilesdir)" |
100 | |
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 | minstalldir ${tmpfilesdir} || die |
120 | |
121 | # install our tmpdfile |
122 | minstallfile ${file} ${tmpfilesdir}/${tmpdfile} || die |
123 | } |