Magellan Linux

Contents of /branches/magellan-next/core/systemd/systemd-34-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9251 - (show annotations) (download)
Wed Nov 23 20:29:24 2011 UTC (12 years, 5 months ago) by niro
File size: 5748 byte(s)
-added sysvinit-tools dependency
1 # $Id$
2
3 PNAME="systemd"
4 PVER="34"
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 >= 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}-33-magellan.patch
51 mirror://${PNAME}/${PNAME}-33-magellan-configurable-getty-4.patch
52 mirror://${PNAME}/login-manager.pamd
53 )
54
55 UP2DATE="updatecmd http://www.freedesktop.org/software/systemd/ | lasttarball"
56
57 src_prepare()
58 {
59 munpack ${SRCFILE} || die
60 cd ${SRCDIR}
61
62 # apply our magellan patch
63 mpatch ${PNAME}-33-magellan.patch || die
64
65 # magellan-only: use a configurable getty
66 mpatch ${PNAME}-33-magellan-configurable-getty-4.patch || die
67
68 # regen configure
69 mautoreconf || die
70 }
71
72 src_compile()
73 {
74 cd ${SRCDIR}
75
76 mconfigure \
77 --with-distro=magellan \
78 --libexecdir=/usr/$(mlibdir)/${PNAME} \
79 --with-pamlibdir=/$(mlibdir)/security \
80 --with-rootdir=/ \
81 --enable-gtk \
82 --enable-pam \
83 --enable-tcpwrap \
84 --disable-audit \
85 --disable-selinux \
86 || die
87
88 mmake || die
89 }
90
91 src_install()
92 {
93 cd ${SRCDIR}
94 mmake DESTDIR=${BINDIR} install || die
95
96 # omit for now as pretty_print works
97 # # install os-release file
98 # cat > ${BINDIR}/etc/os-release << EOF
99 # NAME="Magellan Linux"
100 # ID=magellan
101 # PRETTY_NAME="Magellan Linux"
102 # ANSI_COLOR="1;34"
103 # EOF
104
105 # keep some directories
106 mkeepdir /run || die
107 mkeepdir /etc/modules-load.d || die
108
109 if [[ ${SYSVINIT_SUPPORT} != y ]]
110 then
111 echo "Include SysV init Compat symlinks"
112 # create SysV compatibility symlinks. systemctl/systemd are smart
113 # enough to detect in which way they are called.
114 minstalldir /sbin || die
115 mlink ../bin/systemd /sbin/init || die
116 local i
117 for i in reboot halt poweroff shutdown telinit runlevel
118 do
119 mlink ../bin/systemctl /sbin/${i} || die
120 done
121 else
122 echo "Using sysvinit package for SysV compat"
123 fi
124
125 # we create all wants links manually at installation time to make sure
126 # they are not owned and hence overriden by mage after the user deleted
127 # them.
128 rm -r ${BINDIR}/etc/systemd/system/*.target.wants || die
129 # but make sure these directories are properly owned
130 mkeepdir /lib/systemd/system/basic.target.wants || die
131 mkeepdir /lib/systemd/system/default.target.wants || die
132 mkeepdir /lib/systemd/system/dbus.target.wants || die
133 mkeepdir /lib/systemd/system/syslog.target.wants || die
134
135 # login-manager pam policy - force register kdm, gdm etc with pam_systemd
136 minstallpam login-manager.pamd login-manager || die
137
138 minstalldocs DISTRO_PORTING LICENSE README TODO || die
139 }
140
141 preinstall()
142 {
143 if [[ ${SYSVINIT_SUPPORT} = n ]]
144 then
145 if [[ ! -z $(magequery -n sysvinit) ]]
146 then
147 echo -e ${COLRED}
148 echo -e "Error: sys-apps/sysvinit is installed!!"
149 echo -e "sysvinit is now replaced by systemd which is the new default init system."
150 echo -e "Please uninstall sys-apps/sysvinit first!"
151 echo -e ${COLDEFAULT}
152 die "sys-apps/sysvinit found!"
153 fi
154 fi
155
156 # adding lock group
157 ${MLIBDIR}/mgroupadd -o "-g 54" lock
158 }
159
160 postinstall()
161 {
162 # try to read default runlevel from the old inittab if it exists
163 local runlevel
164 runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' ${MROOT}/etc/inittab 2> /dev/null)
165 local target
166 if [[ -z ${runlevel} ]]
167 then
168 target="/lib/systemd/system/graphical.target"
169 else
170 target="/lib/systemd/system/runlevel${runlevel}.target"
171 fi
172 # and symlink what we found to the new-style default.target
173 ln -snf ${target} ${MROOT}/etc/systemd/system/default.target
174
175 # convert modules.autoload
176 if [ -f ${MROOT}/etc/modules.autoload ]
177 then
178 local modules
179 # get only lines which are not commented or empty;
180 # if we get any items than the modules.autoload is in use
181 modules=$(sed -e '/^#/d' -e '/^$/d' ${MROOT}/etc/modules.autoload)
182 if [[ ! -z ${modules} ]]
183 then
184 [ ! -d ${MROOT}/etc/modules-load.d ] && install -d ${MROOT}/etc/modules-load.d
185 echo -e "# Converted by systemd install from /etc/modules.autoload\n#\n#" \
186 > ${MROOT}/etc/modules-load.d/modules.autoload.conf
187 cat ${MROOT}/etc/modules.autoload \
188 >> ${MROOT}/etc/modules-load.d/modules.autoload.conf
189 fi
190 fi
191
192 # check mtab, and replace with a symlink if required
193 if [[ ! -L ${MROOT}/etc/mtab ]] || \
194 [[ $(readlink ${MROOT}/etc/mtab) != /proc/self/mounts ]]
195 then
196 ln -snf /proc/self/mounts ${MROOT}/etc/mtab
197 fi
198
199 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
200 then
201 # create machine-id
202 if [ ! -f /etc/machine-id ]
203 then
204 systemd-machine-id-setup
205 fi
206
207 # restart systemd daemon
208 systemctl daemon-reexec
209
210 # restart systemd-logind daemon
211 systemctl try-restart systemd-logind.service
212
213 # enable the services we install by default.
214 systemctl enable \
215 getty@.service \
216 remote-fs.target \
217 systemd-readahead-replay.service \
218 systemd-readahead-collect.service
219 fi
220
221 echo
222 echo "systemd has been installed to /bin/systemd. Please ensure you append"
223 echo "init=/bin/systemd to your kernel command line in your bootloader."
224 echo
225 }