Magellan Linux

Contents of /trunk/include/systemd.sminc

Parent Directory Parent Directory | Revision Log Revision Log


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