Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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