Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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