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