Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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