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