Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11065 - (show annotations) (download)
Thu Feb 16 09:48:24 2012 UTC (12 years, 3 months ago) by niro
File size: 7087 byte(s)
-multilib fixes
1 # $Id$
2
3 PNAME="systemd"
4 PVER="39"
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 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 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} != 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 # 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 /usr/lib/systemd/system/basic.target.wants || die
164 mkeepdir /usr/lib/systemd/system/default.target.wants || die
165 mkeepdir /usr/lib/systemd/system/dbus.target.wants || die
166 mkeepdir /usr/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 if [[ ${ENABLE_GTK} = 1 ]]
175 then
176 rm ${BINDIR}/usr/bin/systemadm || die
177 rm ${BINDIR}/usr/bin/systemd-gnome-ask-password-agent || die
178 rm ${BINDIR}/usr/share/man/man1/systemadm.* || die
179 fi
180 rm ${BINDIR}/usr/bin/systemd-analyze || die
181 }
182
183 src_install_systemd-tools()
184 {
185 cd ${SRCDIR}
186 if [[ ${ENABLE_GTK} = 1 ]]
187 then
188 minstallexec systemadm || die
189 minstallexec systemd-gnome-ask-password-agent || die
190 minstallman man/systemadm.1 || die
191 fi
192 minstallexec src/systemd-analyze || die
193 }
194
195 preinstall_systemd()
196 {
197 # if [[ ${SYSVINIT_SUPPORT} = 1 ]]
198 # then
199 # if [[ ! -z $(magequery -n sysvinit) ]]
200 # then
201 # echo -e ${COLRED}
202 # echo -e "Error: sys-apps/sysvinit is installed!!"
203 # echo -e "sysvinit is now replaced by systemd which is the new default init system."
204 # echo -e "Please uninstall sys-apps/sysvinit first!"
205 # echo -e ${COLDEFAULT}
206 # die "sys-apps/sysvinit found!"
207 # fi
208 # fi
209
210 # adding lock group
211 ${MLIBDIR}/mgroupadd -o "-g 54" lock
212 }
213
214 postinstall_systemd()
215 {
216 # try to read default runlevel from the old inittab if it exists
217 local runlevel
218 runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null)
219 local target
220 if [[ -z ${runlevel} ]]
221 then
222 target="/usr/lib/systemd/system/graphical.target"
223 else
224 target="/usr/lib/systemd/system/runlevel${runlevel}.target"
225 fi
226 # and symlink what we found to the new-style default.target
227 ln -snf ${target} ${MROOT}/etc/systemd/system/default.target
228
229 # convert modules.autoload
230 if [ -f ${MROOT}/etc/modules.autoload ]
231 then
232 local modules
233 # get only lines which are not commented or empty;
234 # if we get any items than the modules.autoload is in use
235 modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload)
236 if [[ ! -z ${modules} ]]
237 then
238 [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d
239 echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \
240 > ${MROOT}/etc/modules-load.d/modules.autoload.conf
241 cat ${MROOT}/etc/modules.autoload \
242 >> ${MROOT}/etc/modules-load.d/modules.autoload.conf
243 fi
244 fi
245
246 # check mtab, and replace with a symlink if required
247 if [[ ! -L ${MROOT}/etc/mtab ]] || \
248 [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]]
249 then
250 ln -snf /proc/self/mounts ${MROOT}/etc/mtab
251 fi
252
253 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
254 then
255 # create machine-id
256 if [ ! -f /etc/machine-id ]
257 then
258 systemd-machine-id-setup
259 fi
260
261 # restart systemd daemon
262 systemctl daemon-reexec
263
264 # restart systemd-logind daemon
265 systemctl try-restart systemd-logind.service
266
267 # enable the services we install by default.
268 systemctl enable \
269 getty@.service \
270 remote-fs.target \
271 systemd-readahead-replay.service \
272 systemd-readahead-collect.service
273 fi
274
275 echo
276 echo "systemd has been installed to /usr/bin/systemd. Please ensure you append"
277 echo "init=/usr/bin/systemd to your kernel command line in your bootloader."
278 echo
279 }