Magellan Linux

Contents of /smage/trunk/core/busybox/busybox-1.20.2-r10.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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