Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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