Magellan Linux

Contents of /trunk/core/systemd/systemd-43-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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