Contents of /smage/trunk/core/busybox/busybox-1.20.2-r31.smage2
Parent Directory | Revision Log
Revision 8364 -
(show annotations)
(download)
Fri Jan 15 14:32:36 2016 UTC (8 years, 4 months ago) by niro
File size: 13664 byte(s)
Fri Jan 15 14:32:36 2016 UTC (8 years, 4 months ago) by niro
File size: 13664 byte(s)
auto added: ver bump to 1.24.1-r1
1 | # $Id$ |
2 | |
3 | PNAME="busybox" |
4 | PVER="1.20.2" |
5 | PBUILD="r31" |
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 | PROVIDE="virtual/bzip2 |
13 | virtual/cron |
14 | virtual/debianutils |
15 | virtual/dhcp |
16 | virtual/ed |
17 | virtual/eject |
18 | virtual/grep |
19 | virtual/gzip |
20 | virtual/inetutils |
21 | virtual/kbd |
22 | virtual/less |
23 | virtual/net-tools |
24 | virtual/pciutils |
25 | virtual/procps |
26 | virtual/psmisc |
27 | virtual/sed |
28 | virtual/shadow |
29 | virtual/sysvinit |
30 | virtual/sysvinit-tools |
31 | virtual/tar |
32 | virtual/unzip |
33 | virtual/usbutils |
34 | virtual/which |
35 | virtual/wget |
36 | virtual/xz-utils" |
37 | |
38 | # busbox config revision |
39 | CFG_REV=1.16 |
40 | # udhcpc client script revision |
41 | UDHCPC_REV=1.1 |
42 | # busybox.tmpfilesd revision |
43 | TMP_REV=1.2 |
44 | # agetty emulation script revision |
45 | AGETTY_REV=1.3 |
46 | # loadkeys emulation script revision |
47 | LOADKEYS_REV=1.4 |
48 | # server services revisions |
49 | HTTPD_SVC_REV=1.2 |
50 | UDHCPD_SVC_REV=1.2 |
51 | TFTPD_SVC_REV=1.3 |
52 | TFTPD_CONFD_REV=1.2 |
53 | |
54 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
55 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
56 | |
57 | sminclude mtools systemd alx |
58 | |
59 | # shared busybox needs glibc and overwrite systemd dep pulled by systemd include |
60 | DEPEND=">= virtual/glibc" |
61 | |
62 | SRC_URI=( |
63 | http://www.busybox.net/downloads/${SRCFILE} |
64 | mirror://${PNAME}/${SRCFILE} |
65 | mirror://${PNAME}/config-${CFG_REV} |
66 | mirror://${PNAME}/udhcpc.sh-${UDHCPC_REV} |
67 | mirror://${PNAME}/de.kmap.gz |
68 | mirror://${PNAME}/zgrep.sh |
69 | mirror://${PNAME}/nologin.c |
70 | mirror://${PNAME}/crond.service |
71 | mirror://${PNAME}/busybox.tmpfilesd-${TMP_REV} |
72 | mirror://${PNAME}/loadkeys.sh-${LOADKEYS_REV} |
73 | mirror://${PNAME}/agetty.sh-${AGETTY_REV} |
74 | mirror://${PNAME}/autologin.sh |
75 | mirror://${PNAME}/lat9w-16.psfu.gz |
76 | mirror://${PNAME}/LatArCyrHeb-16.psfu.gz |
77 | mirror://${PNAME}/httpd.service-${HTTPD_SVC_REV} |
78 | mirror://${PNAME}/httpd.confd |
79 | mirror://${PNAME}/httpd.tmpfilesd |
80 | mirror://${PNAME}/udhcpd.service-${UDHCPD_SVC_REV} |
81 | mirror://${PNAME}/udhcpd.confd |
82 | mirror://${PNAME}/udhcpd.tmpfilesd |
83 | mirror://${PNAME}/tftpd.service-${TFTPD_SVC_REV} |
84 | mirror://${PNAME}/tftpd.socket |
85 | mirror://${PNAME}/tftpd.confd-${TFTPD_CONFD_REV} |
86 | mirror://${PNAME}/tftpd.tmpfilesd |
87 | mirror://${PNAME}/8859-1_to_uni.trans |
88 | mirror://${PNAME}/${PNAME}-1.15.3-flags.patch |
89 | mirror://${PNAME}/${PNAME}-${PVER}-mv-ignore-verbose.patch |
90 | mirror://${PNAME}/${PNAME}-${PVER}-cp-ignore-onefilesystem.patch |
91 | mirror://${PNAME}/${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch |
92 | mirror://${PNAME}/${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch |
93 | mirror://${PNAME}/${PNAME}-${PVER}-set-up-RO-loop-device.patch |
94 | mirror://${PNAME}/${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch |
95 | mirror://${PNAME}/${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch |
96 | mirror://${PNAME}/${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch |
97 | mirror://${PNAME}/${PNAME}-${PVER}-support-strictatime-option.patch |
98 | mirror://${PNAME}/${PNAME}-${PVER}-no-send-signals.patch |
99 | mirror://${PNAME}/${PNAME}-${PVER}-kernel_ver.patch |
100 | mirror://${PNAME}/${PNAME}-${PVER}-pkg-config-selinux.patch |
101 | mirror://${PNAME}/${PNAME}-${PVER}-sys-resource.patch |
102 | mirror://${PNAME}/${PNAME}-${PVER}-ntpd.patch |
103 | mirror://${PNAME}/${PNAME}-${PVER}-f2fs.patch |
104 | mirror://${PNAME}/${PNAME}-${PVER}-xz-multiple-streams.patch |
105 | ) |
106 | |
107 | src_prepare() |
108 | { |
109 | munpack ${SRCFILE} || die |
110 | munpack de.kmap.gz ${SRCDIR} || die |
111 | munpack lat9w-16.psfu.gz ${SRCDIR} || die |
112 | munpack LatArCyrHeb-16.psfu.gz ${SRCDIR} || die |
113 | cd ${SRCDIR} |
114 | |
115 | # official patches |
116 | # tar: support xz -J --xz option |
117 | mpatch ${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch || die |
118 | # use common defines, needed by mount patches |
119 | mpatch ${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch || die |
120 | # fix missing loop device |
121 | mpatch ${PNAME}-${PVER}-set-up-RO-loop-device.patch || die |
122 | # fix ext2 breakage with ext4 drivers |
123 | mpatch ${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch || die |
124 | # fix mount |
125 | mpatch ${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch || die |
126 | # systemd adds comments to fstab |
127 | mpatch ${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch || die |
128 | # mount: support strictatime option (needed by dracut) |
129 | mpatch ${PNAME}-${PVER}-support-strictatime-option.patch || die |
130 | # fix uname |
131 | mpatch ${PNAME}-${PVER}-kernel_ver.patch || die |
132 | # fix build against newer selinux |
133 | mpatch ${PNAME}-${PVER}-pkg-config-selinux.patch || die |
134 | # fix build against newer glibc (>=2.16) / official patch |
135 | mpatch ${PNAME}-${PVER}-sys-resource.patch || die |
136 | # fix ntpd issues |
137 | mpatch ${PNAME}-${PVER}-ntpd.patch || die |
138 | # fix xz multiple streams bug |
139 | # see: https://bugs.busybox.net/show_bug.cgi?id=5804 |
140 | # and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686502 |
141 | mpatch ${PNAME}-${PVER}-xz-multiple-streams.patch || die |
142 | |
143 | # magellan patches |
144 | # remove broken cflags |
145 | mpatch ${PNAME}-1.15.3-flags.patch || die |
146 | # let mv ignore the verbose mode switch (mv -v prints an error) |
147 | mpatch ${PNAME}-${PVER}-mv-ignore-verbose.patch || die |
148 | # let cp ignore the onefilesystem mode switch (cp -x prints an error) |
149 | mpatch ${PNAME}-${PVER}-cp-ignore-onefilesystem.patch || die |
150 | # do not send any signals on shutdown/reboot, we doing this via sendsignals rc |
151 | mpatch ${PNAME}-${PVER}-no-send-signals.patch || die |
152 | # fix libvolume_id to support f2fs |
153 | mpatch ${PNAME}-${PVER}-f2fs.patch || die |
154 | |
155 | # using a custom config |
156 | cp ${SOURCEDIR}/${PNAME}/config-${CFG_REV} .config || die |
157 | |
158 | # disable fbsplash |
159 | sed -i -e 's/.*\(CONFIG_FBSPLASH\).*/#\ \1 is not set/' \ |
160 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_8BPP\).*/#\ \1 is not set/' \ |
161 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_SPRITES\).*/#\ \1 is not set/' \ |
162 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_TEXT\).*/#\ \1 is not set/' \ |
163 | -e 's/.*\(CONFIG_FEATURE_FBSPLASH_FONTLOAD\).*/#\ \1 is not set/' \ |
164 | .config || die |
165 | |
166 | # socket activation support |
167 | echo "CONFIG_FEATURE_SYSTEMD=y" >> .config || die |
168 | |
169 | # setfont should use kbd resources in /usr/share (consolefonts, consoletrans etc) |
170 | sed -i 's:.*\(CONFIG_DEFAULT_SETFONT_DIR\).*:\1="/usr/share":' .config || die |
171 | |
172 | # disable syslogd in favor of journald |
173 | sed -i -e 's/.*\(CONFIG_SYSLOGD\).*/#\ \1 is not set/' \ |
174 | -e 's/.*\(CONFIG_FEATURE_ROTATE_LOGFILE\).*/#\ \1 is not set/' \ |
175 | -e 's/.*\(CONFIG_FEATURE_REMOTE_LOG\).*/#\ \1 is not set/' \ |
176 | -e 's/.*\(CONFIG_FEATURE_SYSLOGD_DUP\).*/#\ \1 is not set/' \ |
177 | -e 's/.*\(CONFIG_FEATURE_SYSLOGD_CFG\).*/#\ \1 is not set/' \ |
178 | -e 's/.*\(CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE\).*/\1=0/' \ |
179 | -e 's/.*\(CONFIG_FEATURE_IPC_SYSLOG\).*/#\ \1 is not set/' \ |
180 | -e 's/.*\(CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE\).*/\1=0/' \ |
181 | -e 's/.*\(CONFIG_LOGREAD\).*/#\ \1 is not set/' \ |
182 | -e 's/.*\(CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING\).*/#\ \1 is not set/' \ |
183 | .config || die |
184 | |
185 | # enable tftpd for alx-server/mcored |
186 | sed -i 's/.*\(CONFIG_TFTPD\).*/\1=y/' .config || die |
187 | |
188 | # enable udpsvc and tcpsvc (udpsvc is required by tftpd) |
189 | sed -i 's/.*\(CONFIG_UDPSVD\).*/\1=y/' .config || die |
190 | sed -i 's/.*\(CONFIG_TCPSVD\).*/\1=y/' .config || die |
191 | |
192 | # enable udhcpd for alx-server/mcored |
193 | sed -i -e 's/.*\(CONFIG_UDHCPD\).*/\1=y/' \ |
194 | -e 's/.*\(CONFIG_DHCPRELAY\).*/\1=y/' \ |
195 | -e 's/.*\(CONFIG_DUMPLEASES\).*/\1=y/' \ |
196 | -e 's/.*\(CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY\).*/\1=y/' \ |
197 | -e 's/.*\(CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC\).*/\1=y/' \ |
198 | -e 's/.*\(CONFIG_DHCPD_LEASES_FILE\).*/\1=\"\/var\/lib\/udhcpd\/udhcpd.leases\"/' \ |
199 | .config || die |
200 | |
201 | # enable httpd for alx-server/mcored |
202 | sed -i -e 's/.*\(CONFIG_HTTPD\).*/\1=y/' \ |
203 | -e 's/.*\(CONFIG_FEATURE_HTTPD_RANGES\).*/\1=y/' \ |
204 | -e 's/.*\(CONFIG_FEATURE_HTTPD_USE_SENDFILE\).*/\1=y/' \ |
205 | -e 's/.*\(CONFIG_FEATURE_HTTPD_SETUID\).*/\1=y/' \ |
206 | -e 's/.*\(CONFIG_FEATURE_HTTPD_BASIC_AUTH\).*/\1=y/' \ |
207 | -e 's/.*\(CONFIG_FEATURE_HTTPD_AUTH_MD5\).*/\1=y/' \ |
208 | -e 's/.*\(CONFIG_FEATURE_HTTPD_CGI\).*/\1=y/' \ |
209 | -e 's/.*\(CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR\).*/\1=y/' \ |
210 | -e 's/.*\(CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV\).*/\1=y/' \ |
211 | -e 's/.*\(CONFIG_FEATURE_HTTPD_ENCODE_URL_STR\).*/\1=y/' \ |
212 | -e 's/.*\(CONFIG_FEATURE_HTTPD_ERROR_PAGES\).*/\1=y/' \ |
213 | -e 's/.*\(CONFIG_FEATURE_HTTPD_PROXY\).*/\1=y/' \ |
214 | -e 's/.*\(CONFIG_FEATURE_HTTPD_GZIP\).*/\1=y/' \ |
215 | .config || die |
216 | |
217 | # systemd compat for confolefonts dir, systemd requires /usr/share/kbd subdir |
218 | sed -i -e 's/.*\(CONFIG_DEFAULT_SETFONT_DIR\).*/\1=\"\/usr\/share\/kbd\"/' \ |
219 | .config || die |
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 | # remove some applet symlinks which are provided by other packages |
236 | ### patch |
237 | sed -i '/usr\/bin\/patch$/d' busybox.links || die |
238 | ### e2fsprogs |
239 | sed -i '/sbin\/fsck$/d' busybox.links || die |
240 | sed -i '/sbin\/mke2fs$/d' busybox.links || die |
241 | sed -i '/sbin\/mkfs.ext2$/d' busybox.links || die |
242 | sed -i '/sbin\/tune2fs$/d' busybox.links || die |
243 | ### binutils |
244 | sed -i '/usr\/bin\/ar$/d' busybox.links || die |
245 | sed -i '/usr\/bin\/strings$/d' busybox.links || die |
246 | ### diffutils |
247 | sed -i '/usr\/bin\/cmp$/d' busybox.links || die |
248 | ### umount (use from util-linux, need -t option) |
249 | sed -i '/bin\/umount$/d' busybox.links || die |
250 | ### mount (systemd needs a full featured version) |
251 | sed -i '/bin\/mount$/d' busybox.links || die |
252 | |
253 | # provided by systemd |
254 | sed -i '/sbin\/init$/d' busybox.links || die |
255 | sed -i '/sbin\/reboot$/d' busybox.links || die |
256 | sed -i '/sbin\/halt$/d' busybox.links || die |
257 | sed -i '/sbin\/poweroff$/d' busybox.links || die |
258 | sed -i '/sbin\/runlevel$/d' busybox.links || die |
259 | |
260 | # collides with dracut network module |
261 | sed -i '/sbin\/ifup$/d' busybox.links || die |
262 | sed -i '/sbin\/ifdown$/d' busybox.links || die |
263 | |
264 | # use ln of coreutils to support --relative option |
265 | sed -i '/bin\/ln$/d' busybox.links || die |
266 | |
267 | # setfont resides in /bin on newer systems |
268 | sed -i 's:/sbin/setfont:/bin/setfont:' busybox.links || die |
269 | |
270 | # honor usr move |
271 | sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die |
272 | |
273 | # build nologin program |
274 | gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die |
275 | } |
276 | |
277 | src_install() |
278 | { |
279 | cd ${SRCDIR} |
280 | |
281 | minstallexec busybox || die |
282 | # set suid bit for suid applets like su |
283 | mchmod +s /usr/bin/busybox || die |
284 | |
285 | minstalldir /usr/share/busybox || die |
286 | minstallfile busybox.links /usr/share/busybox || die |
287 | |
288 | # systemd needs the keymaps in /usr/share/kbd/keymaps and no! symlinks are allowed |
289 | # keymaps must end with .map or .map.gz |
290 | # dracut uses /usr/share/kbd/keymaps too |
291 | minstalldir /usr/share/kbd/keymaps || die |
292 | minstallfile de.kmap /usr/share/kbd/keymaps/de.map || die |
293 | |
294 | minstalldir /usr/share/udhcpc || die |
295 | minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die |
296 | |
297 | # install example udhcpd.conf |
298 | minstalletc examples/udhcp/udhcpd.conf || die |
299 | |
300 | # install initsystem services |
301 | minstallunit crond.service || die |
302 | minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die |
303 | |
304 | # install server system services |
305 | # udhcpd |
306 | minstallunit udhcpd.service-${UDHCPD_SVC_REV} udhcpd.service || die |
307 | minstallconf udhcpd.confd udhcpd || die |
308 | minstalltmp udhcpd.tmpfilesd udhcpd.conf || die |
309 | # tftpd |
310 | minstallunit tftpd.service-${TFTPD_SVC_REV} tftpd.service || die |
311 | minstallunit tftpd.socket || die |
312 | minstallconf tftpd.confd-${TFTPD_CONFD_REV} tftpd || die |
313 | minstalltmp tftpd.tmpfilesd tftpd.conf || die |
314 | # httpd |
315 | minstallunit httpd.service-${HTTPD_SVC_REV} httpd.service || die |
316 | minstallconf httpd.confd httpd || die |
317 | minstalltmp httpd.tmpfilesd httpd.conf || die |
318 | |
319 | # loadkeys emulation script |
320 | minstallexec -s loadkeys.sh-${LOADKEYS_REV} /usr/bin/loadkeys || die |
321 | |
322 | # agetty emulation script |
323 | minstalldir /usr/sbin || die |
324 | minstallexec -s agetty.sh-${AGETTY_REV} /usr/sbin/agetty || die |
325 | |
326 | # autologin helper script |
327 | minstallexec -s autologin.sh /usr/sbin/autologin || die |
328 | |
329 | # install service configuration files and keep needed directories |
330 | mkeepdir /var/spool/cron/crontabs || die |
331 | |
332 | # install a busybox compilant zgrep script, at last needed by plymouth |
333 | minstallexec -s zgrep.sh /usr/bin/zgrep || die |
334 | |
335 | # install consolefont and trans from kbd-1.15.5 to fully emulate kbd |
336 | # for systemd without any configfile changes |
337 | # busybox cmds requires the base name without any extension, we provide symlinks for systemd |
338 | minstalldir /usr/share/kbd/consolefonts || die |
339 | minstallfile lat9w-16.psfu /usr/share/kbd/consolefonts/lat9w-16 || die |
340 | mlink lat9w-16 /usr/share/kbd/consolefonts/lat9w-16.psfu || die |
341 | minstallfile LatArCyrHeb-16.psfu /usr/share/kbd/consolefonts/LatArCyrHeb-16 || die |
342 | mlink LatArCyrHeb-16 /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu || die |
343 | minstalldir /usr/share/kbd/consoletrans || die |
344 | minstallfile -s 8859-1_to_uni.trans /usr/share/kbd/consoletrans/8859-1_to_uni || die |
345 | mlink 8859-1_to_uni /usr/share/kbd/consoletrans/8859-1_to_uni.trans || die |
346 | |
347 | # install nologin program |
348 | minstalldir /usr/sbin || die |
349 | minstallexec nologin /usr/sbin/nologin || die |
350 | |
351 | # install unimaps directory and a README to suppress warning messages by dracut |
352 | minstalldir /usr/share/kbd/unimaps || die |
353 | MCONFIG=/usr/share/kbd/unimaps/README || die |
354 | mclearconfig || die |
355 | maddconfig '# This directory only exist for compatibility reasons' || die |
356 | } |
357 | |
358 | postinstall() |
359 | { |
360 | if [ -x ${MROOT}/usr/bin/busybox ] |
361 | then |
362 | echo "Setting suid bit for ${MROOT}/usr/bin/busybox" |
363 | chmod +s ${MROOT}/usr/bin/busybox |
364 | fi |
365 | |
366 | if [ -f ${MROOT}/usr/share/busybox/busybox.links ] |
367 | then |
368 | echo "Setting up busybox links ... " |
369 | local i |
370 | for i in $(< ${MROOT}/usr/share/busybox/busybox.links) |
371 | do |
372 | ln -snf /usr/bin/busybox ${MROOT}/${i} |
373 | done |
374 | fi |
375 | } |