Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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