Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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