Magellan Linux

Contents of /branches/magellan-next/core/systemd/systemd-37-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9496 - (show annotations) (download)
Fri Dec 2 15:17:19 2011 UTC (12 years, 5 months ago) by niro
File size: 7797 byte(s)
-make the buildsystem happy
1 # $Id$
2
3 PNAME="systemd"
4 PVER="37"
5 PBUILD="r3"
6
7 SPLIT_PACKAGES="systemd systemd-tools"
8 PCATEGORIE="sys-apps"
9
10 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
11
12 # enable sysvinit support atm for compatibility reasons
13 # y=yes, n=no
14 SYSVINIT_SUPPORT="n"
15
16 COMMON_DEPEND=">= sys-apps/dbus-1.5
17 >= sys-fs/udev-172
18 >= dev-libs/dbus-glib-0.98
19 >= sys-apps/tcp-wrappers-7.6
20 >= sys-libs/pam-1.1
21 >= sys-libs/libcap-2.20
22 >= sys-apps/util-linux-2.20
23 >= sys-apps/shadow-4.1
24 >= sys-apps/sysvinit-tools-2.88"
25
26 TOOLS_DEPEND=">= x11-libs/gtk2+-2.24
27 >= dev-python/dbus-python-0.84
28 >= sys-apps/polkit-0.102"
29
30 if [[ ${SYSVINIT_SUPPORT} = y ]]
31 then
32 DEPEND="${DEPEND}
33 >= sys-apps/sysvinit-2.88"
34 fi
35
36 SDEPEND=">= app-text/docbook-xsl-stylesheets-1.76
37 >= dev-libs/libcgroup-0.37
38 >= dev-libs/libxslt-1.1.26
39 >= dev-lang/vala-0.12
40 >= dev-util/intltool-0.41
41 >= dev-util/gperf-3
42 >= virtual/kernel-headers
43 >= x11-libs/libnotify-0.7.3"
44
45 SRCFILE="${PNAME}-${PVER}.tar.bz2"
46 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
47
48 sminclude mtools
49
50 SRC_URI=(
51 http://www.freedesktop.org/software/${PNAME}/${SRCFILE}
52 mirror://${PNAME}/${SRCFILE}
53 mirror://${PNAME}/${PNAME}-37-magellan.patch
54 mirror://${PNAME}/${PNAME}-33-magellan-configurable-getty-5.patch
55 mirror://${PNAME}/login-manager.pamd
56 mirror://${PNAME}/${PNAME}-${PVER}-unit-fix-complementing-of-requirement-deps-with-after.patch
57 mirror://${PNAME}/${PNAME}-${PVER}-manager-fix-a-crash-in-isolating.patch
58 mirror://${PNAME}/${PNAME}-${PVER}-systemctl-completion-always-invoke-with-no-legend.patch
59 mirror://${PNAME}/${PNAME}-${PVER}-mount-order-remote-mounts-after-both-network.target-and-remote-fs-pre.target.patch
60 mirror://${PNAME}/${PNAME}-${PVER}-units-drop-install-section-from-remote-fs-pre.target.patch
61 )
62
63 UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | lasttarball"
64
65 split_info_systemd()
66 {
67 DESCRIPTION="System and Session Manager."
68 DEPEND="${COMMON_DEPEND}"
69 }
70
71 split_info_systemd-tools()
72 {
73 DESCRIPTION="Systemd utilites for gtk2/gnome and for analysing the boot process."
74 DEPEND="== sys-apps/systemd-${PVER}
75 ${TOOLS_DEPEND}"
76 }
77
78 src_prepare()
79 {
80 munpack ${SRCFILE} || die
81 cd ${SRCDIR}
82
83 # apply our magellan patch
84 mpatch ${PNAME}-37-magellan.patch || die
85
86 # magellan-only: use a configurable getty
87 mpatch ${PNAME}-33-magellan-configurable-getty-5.patch || die
88
89 # upstream and fedore patches
90 # from fedora:
91 # revert this one for https://bugzilla.redhat.com/show_bug.cgi?id=741078
92 # must keep until https://bugzilla.redhat.com/show_bug.cgi?id=741115 is fixed.
93 patch -Np1 -R -i ${SOURCEDIR}/${PNAME}/${PNAME}-${PVER}-unit-fix-complementing-of-requirement-deps-with-after.patch || die
94 #
95 # some post-v37 patches from upstream:
96 mpatch ${PNAME}-${PVER}-manager-fix-a-crash-in-isolating.patch || die
97 mpatch ${PNAME}-${PVER}-systemctl-completion-always-invoke-with-no-legend.patch || die
98 mpatch ${PNAME}-${PVER}-mount-order-remote-mounts-after-both-network.target-and-remote-fs-pre.target.patch || die
99 mpatch ${PNAME}-${PVER}-units-drop-install-section-from-remote-fs-pre.target.patch || die
100
101 # regen configure
102 mautoreconf || die
103 }
104
105 src_compile()
106 {
107 cd ${SRCDIR}
108
109 mconfigure \
110 --with-distro=magellan \
111 --libexecdir=/usr/$(mlibdir)/${PNAME} \
112 --with-pamlibdir=/$(mlibdir)/security \
113 --with-rootdir=/ \
114 --enable-gtk \
115 --enable-pam \
116 --enable-tcpwrap \
117 --disable-audit \
118 --disable-selinux \
119 || die
120
121 mmake || die
122 }
123
124 src_install_systemd()
125 {
126 cd ${SRCDIR}
127 mmake DESTDIR=${BINDIR} install || die
128
129 # omit for now as pretty_print works
130 # # install os-release file
131 # cat > ${BINDIR}/etc/os-release << EOF
132 # NAME="Magellan Linux"
133 # ID=magellan
134 # PRETTY_NAME="Magellan Linux"
135 # ANSI_COLOR="1;34"
136 # EOF
137
138 # keep some directories
139 mkeepdir /run || die
140 mkeepdir /etc/modules-load.d || die
141
142 if [[ ${SYSVINIT_SUPPORT} != y ]]
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 ../bin/systemd /sbin/init || die
149 local i
150 for i in reboot halt poweroff shutdown telinit runlevel
151 do
152 mlink ../bin/systemctl /sbin/${i} || die
153 done
154 else
155 echo "Using sysvinit package for SysV compat"
156 fi
157
158 # we create all wants links manually at installation time to make sure
159 # they are not owned and hence overriden by mage after the user deleted
160 # them.
161 rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die
162 # but make sure these directories are properly owned
163 mkeepdir /lib/systemd/system/basic.target.wants || die
164 mkeepdir /lib/systemd/system/default.target.wants || die
165 mkeepdir /lib/systemd/system/dbus.target.wants || die
166 mkeepdir /lib/systemd/system/syslog.target.wants || die
167
168 # login-manager pam policy - force register kdm, gdm etc with pam_systemd
169 minstallpam login-manager.pamd login-manager || die
170
171 minstalldocs DISTRO_PORTING LICENSE README TODO || die
172
173 # remove files which are owned by other packages
174 rm ${BINDIR}/usr/bin/systemadm || die
175 rm ${BINDIR}/usr/bin/systemd-analyze || die
176 rm ${BINDIR}/usr/bin/systemd-gnome-ask-password-agent || die
177 rm ${BINDIR}/usr/share/man/man1/systemadm.* || die
178 }
179
180 src_install_systemd-tools()
181 {
182 cd ${SRCDIR}
183 minstallexec systemadm || die
184 minstallexec src/systemd-analyze || die
185 minstallexec systemd-gnome-ask-password-agent || die
186 minstallman man/systemadm.1 || die
187 }
188
189 preinstall_systemd()
190 {
191 # if [[ ${SYSVINIT_SUPPORT} = n ]]
192 # then
193 # if [[ ! -z $(magequery -n sysvinit) ]]
194 # then
195 # echo -e ${COLRED}
196 # echo -e "Error: sys-apps/sysvinit is installed!!"
197 # echo -e "sysvinit is now replaced by systemd which is the new default init system."
198 # echo -e "Please uninstall sys-apps/sysvinit first!"
199 # echo -e ${COLDEFAULT}
200 # die "sys-apps/sysvinit found!"
201 # fi
202 # fi
203
204 # adding lock group
205 ${MLIBDIR}/mgroupadd -o "-g 54" lock
206 }
207
208 postinstall_systemd()
209 {
210 # try to read default runlevel from the old inittab if it exists
211 local runlevel
212 runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null)
213 local target
214 if [[ -z ${runlevel} ]]
215 then
216 target="/lib/systemd/system/graphical.target"
217 else
218 target="/lib/systemd/system/runlevel${runlevel}.target"
219 fi
220 # and symlink what we found to the new-style default.target
221 ln -snf ${target} ${MROOT}/etc/systemd/system/default.target
222
223 # convert modules.autoload
224 if [ -f ${MROOT}/etc/modules.autoload ]
225 then
226 local modules
227 # get only lines which are not commented or empty;
228 # if we get any items than the modules.autoload is in use
229 modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload)
230 if [[ ! -z ${modules} ]]
231 then
232 [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d
233 echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \
234 > ${MROOT}/etc/modules-load.d/modules.autoload.conf
235 cat ${MROOT}/etc/modules.autoload \
236 >> ${MROOT}/etc/modules-load.d/modules.autoload.conf
237 fi
238 fi
239
240 # check mtab, and replace with a symlink if required
241 if [[ ! -L ${MROOT}/etc/mtab ]] || \
242 [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]]
243 then
244 ln -snf /proc/self/mounts ${MROOT}/etc/mtab
245 fi
246
247 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
248 then
249 # create machine-id
250 if [ ! -f /etc/machine-id ]
251 then
252 systemd-machine-id-setup
253 fi
254
255 # restart systemd daemon
256 systemctl daemon-reexec
257
258 # restart systemd-logind daemon
259 systemctl try-restart systemd-logind.service
260
261 # enable the services we install by default.
262 systemctl enable \
263 getty@.service \
264 remote-fs.target \
265 systemd-readahead-replay.service \
266 systemd-readahead-collect.service
267 fi
268
269 echo
270 echo "systemd has been installed to /bin/systemd. Please ensure you append"
271 echo "init=/bin/systemd to your kernel command line in your bootloader."
272 echo
273 }