Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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