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