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