Contents of /smage/trunk/core/busybox/busybox-1.20.2-r12.smage2
Parent Directory | Revision Log
Revision 4629 -
(show annotations)
(download)
Tue Mar 19 14:58:18 2013 UTC (11 years, 6 months ago) by niro
File size: 12502 byte(s)
Tue Mar 19 14:58:18 2013 UTC (11 years, 6 months ago) by niro
File size: 12502 byte(s)
-added agetty emulation script for systemd installations
1 | # $Id$ |
2 | |
3 | PNAME="busybox" |
4 | PVER="1.20.2" |
5 | PBUILD="r12" |
6 | |
7 | PCAT="sys-apps" |
8 | |
9 | DESCRIPTION="BusyBox combines tiny versions of many common UNIX utilities into a single small executable." |
10 | HOMEPAGE="http://www.busybox.net/" |
11 | |
12 | # which bootsplash implemantation gets used |
13 | # fbsplash or plymouth |
14 | BOOTSPLASH="plymouth" |
15 | |
16 | # which initsystem should be supported |
17 | # systemd | sysvinit |
18 | INITSYSTEM="systemd" |
19 | |
20 | # needed in post/preinstall |
21 | SPECIAL_VARS+=" BOOTSPLASH INITSYSTEM" |
22 | |
23 | # shared busybox needs glibc |
24 | DEPEND=">= virtual/glibc" |
25 | |
26 | PROVIDE="virtual/bzip2 |
27 | virtual/cron |
28 | virtual/debianutils |
29 | virtual/dhcp |
30 | virtual/ed |
31 | virtual/eject |
32 | virtual/grep |
33 | virtual/gzip |
34 | virtual/inetutils |
35 | virtual/kbd |
36 | irtual/less |
37 | virtual/net-tools |
38 | virtual/pciutils |
39 | virtual/procps |
40 | virtual/psmisc |
41 | virtual/sed |
42 | virtual/shadow |
43 | virtual/syslog |
44 | virtual/sysvinit |
45 | virtual/sysvinit-tools |
46 | virtual/tar |
47 | virtual/unzip |
48 | virtual/usbutils |
49 | virtual/which |
50 | virtual/wget |
51 | virtual/xz-utils" |
52 | |
53 | # busbox config revision |
54 | CFG_REV=1.15 |
55 | # udhcpc client script revision |
56 | UDHCPC_REV=1.1 |
57 | # syslogd.rc revision |
58 | SYSLOGD_REV=1.4 |
59 | # busybox.tmpfilesd revision |
60 | TMP_REV=1.2 |
61 | |
62 | case ${BOOTSPLASH} in |
63 | fbsplash) |
64 | # splash.conf cvs revision |
65 | FBSPLASHCONF_REV=1.4 |
66 | # splash-functions.rc cvs revision |
67 | FBSPLASHRC_REV=1.6 |
68 | |
69 | MISC_PVER="0.1.8" |
70 | MISC_SRCFILE="miscsplashutils-${MISC_PVER}.tar.bz2" |
71 | MISC_SRCDIR="${BUILDDIR}/miscsplashutils-${MISC_PVER}" |
72 | |
73 | SPLASHTHEME_PVER="1.0" |
74 | SPLASHTHEME_SRCFILE="alx-theme-busybox-${SPLASHTHEME_PVER}.tar.bz2" |
75 | SPLASHTHEME_SRCDIR="${BUILDDIR}/alx-theme-busybox-${SPLASHTHEME_PVER}" |
76 | ;; |
77 | |
78 | plymouth) |
79 | PLYSPLASHRC_REV=1.3 |
80 | DEPEND="${DEPEND} |
81 | >= sys-apps/plymouth-0.8.5" |
82 | ;; |
83 | esac |
84 | |
85 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
86 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
87 | |
88 | sminclude mtools alx |
89 | |
90 | SRC_URI=( |
91 | http://www.busybox.net/downloads/${SRCFILE} |
92 | mirror://${PNAME}/${SRCFILE} |
93 | mirror://${PNAME}/config-${CFG_REV} |
94 | mirror://${PNAME}/udhcpc.sh-${UDHCPC_REV} |
95 | mirror://${PNAME}/de.kmap.gz |
96 | mirror://${PNAME}/syslog.conf |
97 | mirror://${PNAME}/zgrep.sh |
98 | mirror://${PNAME}/nologin.c |
99 | mirror://${PNAME}/${PNAME}-1.15.3-flags.patch |
100 | mirror://${PNAME}/${PNAME}-${PVER}-mv-ignore-verbose.patch |
101 | mirror://${PNAME}/${PNAME}-${PVER}-cp-ignore-onefilesystem.patch |
102 | mirror://${PNAME}/${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch |
103 | mirror://${PNAME}/${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch |
104 | mirror://${PNAME}/${PNAME}-${PVER}-set-up-RO-loop-device.patch |
105 | mirror://${PNAME}/${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch |
106 | mirror://${PNAME}/${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch |
107 | mirror://${PNAME}/${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch |
108 | mirror://${PNAME}/${PNAME}-${PVER}-support-strictatime-option.patch |
109 | mirror://${PNAME}/${PNAME}-${PVER}-no-send-signals.patch |
110 | mirror://${PNAME}/${PNAME}-${PVER}-kernel_ver.patch |
111 | mirror://${PNAME}/${PNAME}-${PVER}-pkg-config-selinux.patch |
112 | mirror://${PNAME}/${PNAME}-${PVER}-sys-resource.patch |
113 | mirror://${PNAME}/${PNAME}-${PVER}-ntpd.patch |
114 | ) |
115 | |
116 | case ${INITSYSTEM} in |
117 | sysvinit) |
118 | SRC_URI+=( mirror://${PNAME}/syslogd.rc-${SYSLOGD_REV} |
119 | mirror://${PNAME}/crond.rc ) |
120 | ;; |
121 | |
122 | systemd) |
123 | SRC_URI+=( mirror://${PNAME}/syslogd.confd |
124 | mirror://${PNAME}/syslogd.service |
125 | mirror://${PNAME}/crond.service |
126 | mirror://${PNAME}/busybox.tmpfilesd-${TMP_REV} |
127 | mirror://${PNAME}/loadkeys.sh |
128 | mirror://${PNAME}/agetty.sh ) |
129 | ;; |
130 | esac |
131 | |
132 | case ${BOOTSPLASH} in |
133 | fbsplash) |
134 | SRC_URI+=( mirror://${PNAME}/splash-functions.rc-${FBSPLASHRC_REV} |
135 | mirror://${PNAME}/splash.conf-${FBSPLASHCONF_REV} |
136 | mirror://${PNAME}/${PNAME}-${PVER}-fbsplash-tykef-1.0.patch |
137 | mirror://${PNAME}/${PNAME}-1.17.4-fbsplash-reload-background-image.patch |
138 | http://dev.gentoo.org/~spock/projects/gensplash/current/${MISC_SRCFILE} |
139 | mirror://${PNAME}/${MISC_SRCFILE} |
140 | mirror://${PNAME}/${SPLASHTHEME_SRCFILE} ) |
141 | ;; |
142 | |
143 | plymouth) |
144 | SRC_URI+=( mirror://${PNAME}/splash-functions-plymouth.rc-${PLYSPLASHRC_REV} ) |
145 | ;; |
146 | esac |
147 | |
148 | src_prepare() |
149 | { |
150 | munpack ${SRCFILE} || die |
151 | munpack de.kmap.gz ${SRCDIR} || die |
152 | |
153 | if [[ ${BOOTSPLASH} = fbsplash ]] |
154 | then |
155 | munpack ${MISC_SRCFILE} || die |
156 | munpack ${SPLASHTHEME_SRCFILE} || die |
157 | fi |
158 | cd ${SRCDIR} |
159 | |
160 | # official patches |
161 | # tar: support xz -J --xz option |
162 | mpatch ${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch || die |
163 | # use common defines, needed by mount patches |
164 | mpatch ${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch || die |
165 | # fix missing loop device |
166 | mpatch ${PNAME}-${PVER}-set-up-RO-loop-device.patch || die |
167 | # fix ext2 breakage with ext4 drivers |
168 | mpatch ${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch || die |
169 | # fix mount |
170 | mpatch ${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch || die |
171 | # systemd adds comments to fstab |
172 | mpatch ${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch || die |
173 | # mount: support strictatime option (needed by dracut) |
174 | mpatch ${PNAME}-${PVER}-support-strictatime-option.patch || die |
175 | # fix uname |
176 | mpatch ${PNAME}-${PVER}-kernel_ver.patch || die |
177 | # fix build against newer selinux |
178 | mpatch ${PNAME}-${PVER}-pkg-config-selinux.patch || die |
179 | # fix build against newer glibc (>=2.16) / offical patch |
180 | mpatch ${PNAME}-${PVER}-sys-resource.patch || die |
181 | # fix ntpd issues |
182 | mpatch ${PNAME}-${PVER}-ntpd.patch || die |
183 | |
184 | # magellan patches |
185 | # remove broken cflags |
186 | mpatch ${PNAME}-1.15.3-flags.patch || die |
187 | # let mv ignore the verbose mode switch (mv -v prints an error) |
188 | mpatch ${PNAME}-${PVER}-mv-ignore-verbose.patch || die |
189 | # let cp ignore the onefilesystem mode switch (cp -x prints an error) |
190 | mpatch ${PNAME}-${PVER}-cp-ignore-onefilesystem.patch || die |
191 | # do not send any signals on shutdown/reboot, we doing this via sendsignals rc |
192 | mpatch ${PNAME}-${PVER}-no-send-signals.patch || die |
193 | |
194 | if [[ ${BOOTSPLASH} = fbsplash ]] |
195 | then |
196 | # enhanced fbsplash from tykef |
197 | # http://tykef.havlinda.net/programovani/fbsplash/ |
198 | mpatch ${PNAME}-${PVER}-fbsplash-tykef-1.0.patch || die |
199 | |
200 | # fbsplash: adds 'image:' cmd to be able to reload the background image |
201 | # requires the tykef patch |
202 | mpatch ${PNAME}-1.17.4-fbsplash-reload-background-image.patch || die |
203 | fi |
204 | |
205 | # using a custom config |
206 | cp ${SOURCEDIR}/${PNAME}/config-${CFG_REV} .config || die |
207 | |
208 | if [[ ${BOOTSPLASH} = plymouth ]] |
209 | then |
210 | # disable fbsplash |
211 | sed -i -e 's/.*\(CONFIG_FBSPLASH\).*/#\ \1 is not set/' .config \ |
212 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_8BPP\).*/#\ \1 is not set/' .config \ |
213 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_SPRITES\).*/#\ \1 is not set/' .config \ |
214 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_TEXT\).*/#\ \1 is not set/' .config \ |
215 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_FONTLOAD\).*/#\ \1 is not set/' .config || die |
216 | fi |
217 | |
218 | # socket activation support for syslogd |
219 | if [[ ${INITSYSTEM} = systemd ]] |
220 | then |
221 | echo "CONFIG_FEATURE_SYSTEMD=y" >> .config || die |
222 | else |
223 | echo "# CONFIG_FEATURE_SYSTEMD is not set" >> .config || die |
224 | fi |
225 | } |
226 | |
227 | src_compile() |
228 | { |
229 | cd ${SRCDIR} |
230 | |
231 | make oldconfig || die |
232 | mmake || die |
233 | |
234 | # create a busybox.links file |
235 | HOSTCC=gcc sh applets/busybox.mkll | sort > busybox.links || die |
236 | |
237 | # do not use ash as default sh, we want bin/bash |
238 | sed -i '/bin\/sh/d' busybox.links || die |
239 | |
240 | # use poweroff as default halt command |
241 | sed -i '/sbin\/halt/d' busybox.links || die |
242 | echo -e '#!/bin/sh\n/sbin/poweroff $*' > halt.sh || die |
243 | |
244 | # remove some applet symlinks which are provided by other packages |
245 | ### patch |
246 | sed -i '/usr\/bin\/patch/d' busybox.links || die |
247 | ### e2fsprogs |
248 | sed -i '/sbin\/fsck/d' busybox.links || die |
249 | sed -i '/sbin\/mke2fs/d' busybox.links || die |
250 | sed -i '/sbin\/mkfs.ext2/d' busybox.links || die |
251 | sed -i '/sbin\/tune2fs/d' busybox.links || die |
252 | ### binutils |
253 | sed -i '/usr\/bin\/ar/d' busybox.links || die |
254 | sed -i '/usr\/bin\/strings/d' busybox.links || die |
255 | ### diffutils |
256 | sed -i '/usr\/bin\/cmp/d' busybox.links || die |
257 | ### umount (use from util-linux, need -t option) |
258 | sed -i '/bin\/umount/d' busybox.links || die |
259 | ### mount (systemd needs a full featured version |
260 | sed -i '/bin\/mount/d' busybox.links || die |
261 | |
262 | # honor usr move |
263 | sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die |
264 | |
265 | if [[ ${BOOTSPLASH} = fbsplash ]] |
266 | then |
267 | cd ${MISC_SRCDIR} |
268 | mmake fbres || die |
269 | fi |
270 | |
271 | # build nologin program |
272 | cd ${SRCDIR} |
273 | gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die |
274 | } |
275 | |
276 | src_install() |
277 | { |
278 | cd ${SRCDIR} |
279 | |
280 | minstallexec busybox || die |
281 | # set suid bit for suid applets like su |
282 | mchmod +s /usr/bin/busybox || die |
283 | |
284 | minstalldir /usr/sbin || die |
285 | minstallexec halt.sh /usr/sbin/halt || die |
286 | |
287 | minstalldir /usr/share/busybox || die |
288 | minstallfile busybox.links /usr/share/busybox || die |
289 | |
290 | minstalldir /usr/share/busybox/keymaps || die |
291 | minstallfile de.kmap /usr/share/busybox/keymaps || die |
292 | |
293 | minstalldir /usr/share/udhcpc || die |
294 | minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die |
295 | |
296 | # install initsystem services |
297 | if [[ ${INITSYSTEM} = systemd ]] |
298 | then |
299 | minstallconf syslogd.confd syslogd || die |
300 | minstallunit syslogd.service || die |
301 | minstallunit crond.service || die |
302 | minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die |
303 | # loadkeys emulation script |
304 | minstallexec -s loadkeys.sh /usr/bin/loadkeys || die |
305 | # agetty emualtion script |
306 | minstallexec -s agetty.sh /usr/sbin/agetty || die |
307 | else |
308 | minstallrc syslogd.rc-${SYSLOGD_REV} syslogd || die |
309 | minstallrc crond.rc crond || die |
310 | fi |
311 | |
312 | # install service configuration files and keep needed directories |
313 | minstallfile -s syslog.conf /etc/syslog.conf || die |
314 | mkeepdir /var/spool/cron/crontabs || die |
315 | |
316 | # install a busybox compilant zgrep script, at last needed by plymouth |
317 | minstallexec -s zgrep.sh || die |
318 | |
319 | case ${BOOTSPLASH} in |
320 | fbsplash) |
321 | if [[ ${INITSYSTEM} = sysvinit ]] |
322 | then |
323 | # install splash-functions |
324 | minstallrc splash-functions.rc-${FBSPLASHRC_REV} splash-functions || die |
325 | fi |
326 | minstalldir /etc/splash || die |
327 | minstallfile -s splash.conf-${FBSPLASHCONF_REV} /etc/splash/splash.conf || die |
328 | minstalldir /dev || die |
329 | mkfifo ${BINDIR}/dev/splashfifo || die |
330 | |
331 | # install fbres for splash |
332 | minstallexec ${MISC_SRCDIR}/fbres || die |
333 | |
334 | # install fbsplash theme |
335 | cd ${SPLASHTHEME_SRCDIR} |
336 | make DESTDIR=${BINDIR} install || die |
337 | # set alx theme as default |
338 | mlink alx /etc/splash/themes/default || die |
339 | |
340 | # disable config_protection for themes |
341 | minstalldir /etc/env.d || die |
342 | echo "CONFIG_PROTECT_MASK=/etc/splash/themes" > ${BINDIR}/etc/env.d/15splash || die |
343 | |
344 | # use vt12 for bootsplash and enable SPLASH_X11_TTY for vt03 to supress flickers |
345 | sed -i 's:#SPLASH_X11_TTY=:SPLASH_X11_TTY=:' ${BINDIR}/etc/splash/splash.conf || die |
346 | sed -i 's:^\(SPLASH_X11_TTY=\).*:\1"3":' ${BINDIR}/etc/splash/splash.conf || die |
347 | sed -i 's:^\(SPLASH_TTY=\).*:\1"12":' ${BINDIR}/etc/splash/splash.conf || die |
348 | ;; |
349 | |
350 | plymouth) |
351 | if [[ ${INITSYSTEM} = sysvinit ]] |
352 | then |
353 | # install splash-functions |
354 | minstallrc splash-functions-plymouth.rc-${PLYSPLASHRC_REV} splash-functions || die |
355 | fi |
356 | ;; |
357 | esac |
358 | |
359 | cd ${SRCDIR} |
360 | minstalldir /usr/sbin || die |
361 | minstallexec nologin /usr/sbin/nologin || die |
362 | } |
363 | |
364 | preinstall() |
365 | { |
366 | case ${BOOTSPLASH} in |
367 | fbsplash) add_conf_prot_mask /etc/rc.d/init.d /etc/splash/themes /etc/splash/splash.conf /etc/env.d ;; |
368 | plymouth) add_conf_prot_mask /etc/rc.d/init.d;; |
369 | esac |
370 | } |
371 | |
372 | postinstall() |
373 | { |
374 | if [ -x ${MROOT}/usr/bin/busybox ] |
375 | then |
376 | echo "Setting suid bit for ${MROOT}/usr/bin/busybox" |
377 | chmod +s ${MROOT}/usr/bin/busybox |
378 | fi |
379 | |
380 | if [ -f ${MROOT}/usr/share/busybox/busybox.links ] |
381 | then |
382 | echo "Setting up busybox links ... " |
383 | local i |
384 | for i in $(< ${MROOT}/usr/share/busybox/busybox.links) |
385 | do |
386 | ln -snf /usr/bin/busybox ${MROOT}/${i} |
387 | done |
388 | fi |
389 | |
390 | # run syslogd *after* creating the busybox symlinks! |
391 | if [[ ${INITSYSTEM} = systemd ]] |
392 | then |
393 | mstartunit syslogd.service |
394 | mstartunit crond.service |
395 | else |
396 | mstartservice syslogd |
397 | mstartservice crond |
398 | fi |
399 | |
400 | if [[ ${BOOTSPLASH} = fbsplash ]] |
401 | then |
402 | if [[ ! -p ${MROOT}/dev/splashfifo ]] |
403 | then |
404 | mkfifo ${MROOT}/dev/splashfifo |
405 | fi |
406 | |
407 | # check if intel fb quirk is required |
408 | if [[ -x ${MROOT}/usr/sbin/alx-hwdetection ]] |
409 | then |
410 | local fbdev="$(${MROOT}/usr/sbin/alx-hwdetection intel-fb-quirk)" |
411 | if [[ ${fbdev} -ge 0 ]] |
412 | then |
413 | sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${MROOT}/etc/splash/splash.conf || die |
414 | fi |
415 | fi |
416 | fi |
417 | } |
418 | |
419 | postremove() |
420 | { |
421 | if [[ ${INITSYSTEM} = systemd ]] |
422 | then |
423 | mstopunit syslogd.service |
424 | mstopunit crond.service |
425 | else |
426 | mstopservice syslogd |
427 | mstopservice crond |
428 | fi |
429 | } |