Magellan Linux

Contents of /smage/branches/alx07x-unstable/include/systemd.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13442 - (show annotations) (download)
Thu Jul 11 11:49:06 2019 UTC (4 years, 9 months ago) by niro
File size: 2121 byte(s)
-release unstable
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-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 mget-systemd-tmpfilesdir()
42 {
43 pkg-config systemd --variable=tmpfilesdir
44 }
45
46 mget-systemd-sysusersdir()
47 {
48 pkg-config systemd --variable=sysusersdir
49 }
50
51 mget-systemd-sysctldir()
52 {
53 pkg-config systemd --variable=sysctldir
54 }
55
56 # installs systemd units
57 # minstallunit /path/to/unit-file {destfilename}
58 minstallunit()
59 {
60 local unit
61 local file
62 local systemdunitdir="$(mget-systemd-unit-dir)"
63
64 [[ -z "$1" ]] && die "No unit given"
65
66 # if no fullpath given use file from sourcedir
67 if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
68 then
69 file="${SOURCEDIR}/$(mpname)/$1"
70 else
71 file="$1"
72 fi
73
74 if [[ -n "$2" ]]
75 then
76 unit="$2"
77 else
78 unit="$(basename ${file})"
79 fi
80
81 # needed directory
82 minstalldir ${systemdunitdir} || die
83
84 # install our initscript
85 minstallfile ${file} ${systemdunitdir}/${unit} || die
86 }
87
88 # installs systemd tmp configs to /etc/tmpfiles.d
89 # minstalltmp /path/to/tmpdfile {destfilename}
90 minstalltmp()
91 {
92 local tmpdfile
93 local file
94 local tmpfilesdir="$(mget-systemd-tmpfilesdir)"
95
96 [[ -z "$1" ]] && die "No tmpd file given"
97
98 # if no fullpath given use file from sourcedir
99 if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
100 then
101 file="${SOURCEDIR}/$(mpname)/$1"
102 else
103 file="$1"
104 fi
105
106 if [[ -n "$2" ]]
107 then
108 tmpdfile="$2"
109 else
110 tmpdfile="$(basename ${file})"
111 fi
112
113 # needed directory
114 minstalldir ${tmpfilesdir} || die
115
116 # install our tmpdfile
117 minstallfile ${file} ${tmpfilesdir}/${tmpdfile} || die
118 }