Magellan Linux

Contents of /trunk/core/systemd/systemd-44-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12086 - (show annotations) (download)
Fri May 4 14:05:06 2012 UTC (12 years ago) by niro
File size: 8992 byte(s)
-fixed up2date
1 # $Id$
2
3 PNAME="systemd"
4 PVER="44"
5 PBUILD="r1"
6
7 SPLIT_PACKAGES="systemd systemd-tools"
8
9 PCAT="sys-apps"
10 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
11
12 # enable sysvinit support atm for compatibility reasons
13 # 1=yes, 0=no
14 SYSVINIT_SUPPORT=0
15
16 # disable gtk until build with libgee is fixed
17 # 1=yes, 0=no
18 ENABLE_GTK=0
19
20 # export this variables for preinstall
21 SPECIAL_VARS="SYSVINIT_SUPPORT"
22
23 COMMON_DEPEND=">= sys-apps/dbus-1.5
24 >= sys-fs/udev-172
25 >= sys-fs/cryptsetup-1.4
26 >= dev-libs/dbus-glib-0.98
27 >= dev-libs/libgee-0.7
28 >= net-dns/nss-myhostname-0.3
29 >= app-arch/xz-utils-5
30 >= sys-apps/acl-2.2
31 >= sys-apps/tcp-wrappers-7.6
32 >= sys-libs/pam-1.1
33 >= sys-libs/libcap-2.20
34 >= sys-apps/util-linux-2.20
35 >= sys-apps/shadow-4.1
36 >= sys-apps/sysvinit-tools-2.88
37 >= sys-apps/kmod-5"
38
39 # only /etc/os-release is supported from now on
40 COMMON_DEPEND="${COMMON_DEPEND}
41 >= sys-apps/mage-release-1"
42
43 TOOLS_DEPEND=">= dev-python/dbus-python-0.84
44 >= sys-apps/polkit-0.102"
45
46 if [[ ${ENABLE_GTK} = 1 ]]
47 then
48 TOOLS_DEPEND="${TOOLS_DEPEND}
49 >= x11-libs/gtk2+-2.24
50 >= dev-libs/libgee-0.7"
51 fi
52
53 if [[ ${SYSVINIT_SUPPORT} = 1 ]]
54 then
55 DEPEND="${DEPEND}
56 >= sys-apps/sysvinit-2.88"
57 fi
58
59 SDEPEND=">= app-text/docbook-xsl-stylesheets-1.76
60 >= dev-libs/libcgroup-0.37
61 >= dev-libs/libxslt-1.1.26
62 >= dev-lang/vala-0.12
63 >= dev-util/intltool-0.41
64 >= dev-util/gperf-3
65 >= virtual/kernel-headers
66 >= x11-libs/libnotify-0.7.3"
67
68 SRCFILE="${PNAME}-${PVER}.tar.xz"
69 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
70
71 if [[ ${ENABLE_GTK} = 1 ]]
72 then
73 UI_PVER="1"
74 UI_SRCFILE="${PNAME}-ui-${UI_PVER}.tar.xz"
75 UI_SRCDIR="${BUILDDIR}/${PNAME}-ui-${PVER}"
76 fi
77
78 sminclude mtools multilib
79
80 SRC_URI=(
81 http://www.freedesktop.org/software/${PNAME}/${SRCFILE}
82 mirror://${PNAME}/${SRCFILE}
83 mirror://${PNAME}/${PNAME}-44-magellan.patch
84 mirror://${PNAME}/${PNAME}-38-magellan-configurable-getty.patch
85 mirror://${PNAME}/${PNAME}-43-fix-man-hints.patch
86 mirror://${PNAME}/login-manager.pamd
87 )
88
89 if [[ ${ENABLE_GTK} = 1 ]]
90 then
91 SRC_URI+=( http://www.freedesktop.org/software/${PNAME}/${UI_SRCFILE} )
92 fi
93
94 UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | grep ${PNAME}-[0-9] | lasttarball xz"
95
96 split_info_systemd()
97 {
98 DESCRIPTION="System and Session Manager."
99 DEPEND="${COMMON_DEPEND}"
100 }
101
102 split_info_systemd-tools()
103 {
104 local gtkdesc
105 [[ ${ENABLE_GTK} = 1 ]] && gtkdesc="for gtk2/gnome and "
106
107 DESCRIPTION="Systemd utilites ${gtkdesc}for analysing the boot process."
108 DEPEND="== sys-apps/systemd-${PVER}
109 ${TOOLS_DEPEND}"
110 }
111
112 src_prepare()
113 {
114 munpack ${SRCFILE} || die
115 if [[ ${ENABLE_GTK} = 1 ]]
116 then
117 SRCDIR="${UI_SRCDIR}" munpack ${UI_SRCFILE} || die
118 fi
119
120 # apply our magellan patch
121 mpatch ${PNAME}-44-magellan.patch || die
122
123 # magellan-only: use a configurable getty
124 mpatch ${PNAME}-38-magellan-configurable-getty.patch || die
125
126 # fix hints for man-pages in configs
127 mpatch ${PNAME}-43-fix-man-hints.patch || die
128
129 # let rsyslog read from /proc/kmsg for now
130 all-abis sed -i "s:#ImportKernel=yes:ImportKernel=no:" src/journal/systemd-journald.conf || die
131
132 # regen configure
133 mautoreconf || die
134 }
135
136 src_compile()
137 {
138 mconfigure \
139 --with-distro=magellan \
140 --libexecdir=/usr/'$(mlibdir)' \
141 --with-pamlibdir=/'$(mlibdir)'/security \
142 --with-rootdir=/ \
143 --enable-pam \
144 --enable-tcpwrap \
145 --enable-xz \
146 --enable-acl \
147 --enable-libcryptsetup \
148 --enable-plymouth \
149 --enable-split-usr \
150 --disable-audit \
151 --disable-selinux \
152 || die
153
154 mmake || die
155
156 if [[ ${ENABLE_GTK} = 1 ]]
157 then
158 SRCDIR="${UI_SRCDIR}" mconfigure || die
159 SRCDIR="${UI_SRCDIR}" mmake || die
160 fi
161 }
162
163 src_install_systemd()
164 {
165 mmake DESTDIR=${BINDIR} install || die
166 if [[ ${ENABLE_GTK} = 1 ]]
167 then
168 SRCDIR="${UI_SRCDIR}" mmake DESTDIR=${BINDIR} install || die
169 fi
170
171 # keep some directories
172 mkeepdir /run || die
173 mkeepdir /etc/modules-load.d || die
174 mkeepdir /etc/sysctl.d || die
175 mkeepdir /etc/tmpfiles.d || die
176 mkeepdir /etc/binfmt.d || die
177
178 if [[ ${SYSVINIT_SUPPORT} != 1 ]]
179 then
180 echo "Include SysV init Compat symlinks"
181 # create SysV compatibility symlinks. systemctl/systemd are smart
182 # enough to detect in which way they are called.
183 minstalldir /sbin || die
184 mlink ../usr/lib/systemd/systemd /sbin/init || die
185 local i
186 for i in reboot halt poweroff shutdown telinit runlevel
187 do
188 mlink ../usr/bin/systemctl /sbin/${i} || die
189 done
190 else
191 echo "Using sysvinit package for SysV compat"
192 fi
193
194 # do not package the kernel.core_pattern setting until systemd-coredump
195 # is a part of an actual systemd release and it's made clear how to get
196 # the core dumps out of the journal
197 rm ${BINDIR}/usr/lib/sysctl.d/coredump.conf || die
198 rm -r ${BINDIR}/usr/lib/sysctl.d || die
199
200 # we create all wants links manually at installation time to make sure
201 # they are not owned and hence overriden by mage after the user deleted
202 # them.
203 rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die
204 # but make sure these directories are properly owned
205 mkeepdir /usr/lib/systemd/system/basic.target.wants || die
206 mkeepdir /usr/lib/systemd/system/default.target.wants || die
207 mkeepdir /usr/lib/systemd/system/dbus.target.wants || die
208 mkeepdir /usr/lib/systemd/system/syslog.target.wants || die
209 # make sure the user generators dir exists too
210 mkeepdir /usr/lib/systemd/user-generators || die
211
212 # login-manager pam policy - force register kdm, gdm etc with pam_systemd
213 all-abis minstallpam login-manager.pamd login-manager || die
214
215 # do not bother with non-existend services, mask them
216 mlink /dev/null /etc/systemd/system/syslog.service || die
217 mlink /dev/null /etc/systemd/system/rc-local.service || die
218 mlink /dev/null /etc/systemd/system/auditd.service || die
219
220 minstalldocs DISTRO_PORTING LICENSE README TODO || die
221
222 # remove files which are owned by other packages
223 if [[ ${ENABLE_GTK} = 1 ]]
224 then
225 rm ${BINDIR}/usr/bin/systemadm || die
226 rm ${BINDIR}/usr/bin/systemd-gnome-ask-password-agent || die
227 rm ${BINDIR}/usr/share/man/man1/systemadm.* || die
228 fi
229 rm ${BINDIR}/usr/bin/systemd-analyze || die
230 }
231
232 src_install_systemd-tools()
233 {
234 cd ${SRCDIR}
235 if [[ ${ENABLE_GTK} = 1 ]]
236 then
237 all-abis minstallexec systemadm || die
238 all-abis minstallexec systemd-gnome-ask-password-agent || die
239 all-abis minstallman man/systemadm.1 || die
240 fi
241 all-abis minstallexec src/systemd-analyze || die
242 }
243
244 preinstall_systemd()
245 {
246 if [[ ${SYSVINIT_SUPPORT} = 1 ]]
247 then
248 if [[ ! -z $(magequery -n sysvinit) ]]
249 then
250 echo -e ${COLRED}
251 echo -e "Error: sys-apps/sysvinit is installed!!"
252 echo -e "sysvinit is now replaced by systemd which is the new default init system."
253 echo -e "Please uninstall sys-apps/sysvinit first!"
254 echo -e ${COLDEFAULT}
255 die "sys-apps/sysvinit found!"
256 fi
257 fi
258
259 # adding lock group
260 ${MLIBDIR}/mgroupadd -o "-g 54" lock
261
262 # fix broken systemd installations, where
263 # /usr/lib/systemd/systemd is a directory and not the daemon-exec
264 if [[ -d ${MROOT}/usr/lib/systemd/systemd ]]
265 then
266 rm -r ${MROOT}/usr/lib/systemd/systemd
267 fi
268 }
269
270 postinstall_systemd()
271 {
272 # try to read default runlevel from the old inittab if it exists
273 local runlevel
274 runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null)
275 local target
276 if [[ -z ${runlevel} ]]
277 then
278 target="/usr/lib/systemd/system/graphical.target"
279 else
280 target="/usr/lib/systemd/system/runlevel${runlevel}.target"
281 fi
282 # and symlink what we found to the new-style default.target
283 ln -snf ${target} ${MROOT}/etc/systemd/system/default.target
284
285 # convert modules.autoload
286 if [ -f ${MROOT}/etc/modules.autoload ]
287 then
288 local modules
289 # get only lines which are not commented or empty;
290 # if we get any items than the modules.autoload is in use
291 modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload)
292 if [[ ! -z ${modules} ]]
293 then
294 [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d
295 echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \
296 > ${MROOT}/etc/modules-load.d/modules.autoload.conf
297 cat ${MROOT}/etc/modules.autoload \
298 >> ${MROOT}/etc/modules-load.d/modules.autoload.conf
299 fi
300 fi
301
302 # check mtab, and replace with a symlink if required
303 if [[ ! -L ${MROOT}/etc/mtab ]] || \
304 [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]]
305 then
306 ln -snf /proc/self/mounts ${MROOT}/etc/mtab
307 fi
308
309 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
310 then
311 # create machine-id
312 if [ ! -f /etc/machine-id ]
313 then
314 systemd-machine-id-setup
315 fi
316 # create a random-seed
317 /usr/lib/systemd/systemd-random-seed save
318
319 # restart systemd daemon
320 systemctl daemon-reexec
321
322 # restart systemd-logind daemon
323 systemctl try-restart systemd-logind.service
324
325 # enable the services we install by default.
326 systemctl enable \
327 getty@.service \
328 remote-fs.target \
329 systemd-readahead-replay.service \
330 systemd-readahead-collect.service
331 fi
332
333 echo
334 echo "systemd has been installed to /usr/lib/systemd/systemd. Please ensure you append"
335 echo "init=/usr/lib/systemd/systemd to your kernel command line in your bootloader."
336 echo
337 }