Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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