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