Magellan Linux

Contents of /smage/trunk/core/busybox/busybox-1.29.2-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12080 - (show annotations) (download)
Thu Aug 23 13:38:42 2018 UTC (5 years, 9 months ago) by niro
File size: 10871 byte(s)
-disabled atm, netboot fails
1 # $Id$
2
3 PNAME="busybox"
4 PVER="1.29.2"
5 PBUILD="r3"
6
7 STATE="disabled" # ip -o link show dev [iface] does not print anything and netboot with dracut fails
8 PCAT="sys-apps"
9
10 DESCRIPTION="BusyBox combines tiny versions of many common UNIX utilities into a single small executable."
11 HOMEPAGE="http://www.busybox.net/"
12
13 PROVIDE="virtual/bzip2
14 virtual/cron
15 virtual/debianutils
16 virtual/dhcp
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/xz-utils"
36
37 # busbox config revision
38 CFG_REV=1.22
39 # udhcpc client script revision
40 UDHCPC_REV=1.1
41 # busybox.tmpfilesd revision
42 TMP_REV=1.2
43 # agetty emulation script revision
44 AGETTY_REV=1.3
45 # loadkeys emulation script revision
46 LOADKEYS_REV=1.4
47 # server services revisions
48 HTTPD_SVC_REV=1.2
49 UDHCPD_SVC_REV=1.2
50 TFTPD_SVC_REV=1.4
51 TFTPD_CONFD_REV=1.2
52
53 SRCFILE="${PNAME}-${PVER}.tar.bz2"
54 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
55
56 SDEPEND=">= virtual/sed"
57
58 sminclude mtools systemd alx
59
60 # we do not provide wget applet anymore, so depend on wget too
61 DEPEND=">= net-misc/wget-1.17"
62
63 SRC_URI=(
64 http://www.busybox.net/downloads/${SRCFILE}
65 mirror://${PNAME}/${SRCFILE}
66 mirror://${PNAME}/config-${CFG_REV}
67 mirror://${PNAME}/udhcpc.sh-${UDHCPC_REV}
68 mirror://${PNAME}/de.kmap.gz
69 mirror://${PNAME}/zgrep.sh
70 mirror://${PNAME}/nologin.c
71 mirror://${PNAME}/crond.service
72 mirror://${PNAME}/busybox.tmpfilesd-${TMP_REV}
73 mirror://${PNAME}/loadkeys.sh-${LOADKEYS_REV}
74 mirror://${PNAME}/agetty.sh-${AGETTY_REV}
75 mirror://${PNAME}/autologin.sh
76 mirror://${PNAME}/lat9w-16.psfu.gz
77 mirror://${PNAME}/LatArCyrHeb-16.psfu.gz
78 mirror://${PNAME}/httpd.service-${HTTPD_SVC_REV}
79 mirror://${PNAME}/httpd.confd
80 mirror://${PNAME}/httpd.tmpfilesd
81 mirror://${PNAME}/udhcpd.service-${UDHCPD_SVC_REV}
82 mirror://${PNAME}/udhcpd.confd
83 mirror://${PNAME}/udhcpd.tmpfilesd
84 mirror://${PNAME}/tftpd.service-${TFTPD_SVC_REV}
85 mirror://${PNAME}/tftpd.socket
86 mirror://${PNAME}/tftpd.confd-${TFTPD_CONFD_REV}
87 mirror://${PNAME}/tftpd.tmpfilesd
88 mirror://${PNAME}/8859-1_to_uni.trans
89 mirror://${PNAME}/${PNAME}-1.29.2-cp-ignore-onefilesystem.patch
90 mirror://${PNAME}/${PNAME}-1.27.1-no-send-signals.patch
91 )
92
93 UP2DATE="updatecmd https://busybox.net/downloads/ | grep ${PNAME}-[0-9] | highesttarball"
94
95 src_prepare()
96 {
97 munpack ${SRCFILE} || die
98 munpack de.kmap.gz ${SRCDIR} || die
99 munpack lat9w-16.psfu.gz ${SRCDIR} || die
100 munpack LatArCyrHeb-16.psfu.gz ${SRCDIR} || die
101 cd ${SRCDIR}
102
103 # official patches
104
105 # magellan patches
106 # let cp ignore the onefilesystem mode switch (cp -x prints an error)
107 mpatch ${PNAME}-1.29.2-cp-ignore-onefilesystem.patch || die
108 # do not send any signals on shutdown/reboot, we doing this via sendsignals rc
109 mpatch ${PNAME}-1.27.1-no-send-signals.patch || die
110
111 # using a custom config
112 cp ${SOURCEDIR}/${PNAME}/config-${CFG_REV} .config || die
113
114 # not required for busybox-1.29 anymore
115 # # fix a missing include with linux-musl-headers
116 # sed -i '1i#include <sys/resource.h>' include/libbb.h || die
117
118 # now included in config 1.19
119 # # disable swapon & swapoff; systemd requires the util-linux version
120 # # because it depends on some options the busybox version does not provide
121 # sed -i -e 's/.*\(CONFIG_SWAPONOFF\).*/#\ \1 is not set/' \
122 # -e 's/.*\(CONFIG_FEATURE_SWAPON_DISCARD\).*/#\ \1 is not set/' \
123 # -e 's/.*\(CONFIG_FEATURE_SWAPON_PRI\).*/#\ \1 is not set/' \
124 # .config || die
125
126 # now included in config 1.19
127 # # use full blown wget to support ssl
128 # sed -i -e 's/.*\(CONFIG_WGET\).*/#\ \1 is not set/' \
129 # -e 's/.*\(CONFIG_FEATURE_WGET_STATUSBAR\).*/#\ \1 is not set/' \
130 # -e 's/.*\(CONFIG_FEATURE_WGET_AUTHENTICATION\).*/#\ \1 is not set/' \
131 # -e 's/.*\(CONFIG_FEATURE_WGET_LONG_OPTIONS\).*/#\ \1 is not set/' \
132 # -e 's/.*\(CONFIG_FEATURE_WGET_TIMEOUT\).*/#\ \1 is not set/' \
133 # -e 's/.*\(CONFIG_FEATURE_WGET_OPENSSL\).*/#\ \1 is not set/' \
134 # .config || die
135
136 # now included in config 1.20
137 # # do not use ifup/ifdown from busybox as dracut implements its own
138 # sed -i -e 's/.*\(CONFIG_IFUP\).*/#\ \1 is not set/' \
139 # -e 's/.*\(CONFIG_IFDOWN\).*/#\ \1 is not set/' \
140 # -e 's/.*\(CONFIG_IFUPDOWN_IFSTATE_PATH\).*/#\ \1 is not set/' \
141 # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IP\).*/#\ \1 is not set/' \
142 # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IPV4\).*/#\ \1 is not set/' \
143 # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IPV6\).*/#\ \1 is not set/' \
144 # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_MAPPING\).*/#\ \1 is not set/' \
145 # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP\).*/#\ \1 is not set/' \
146 # .config || die
147
148 # now included in config 1.21
149 # # use full blown losetup cmd from util-linux to fix dracuts losetup -f --show statements
150 # sed -i -e 's/.*\(CONFIG_LOSETUP\).*/#\ \1 is not set/' .config || die
151 #
152 # # use full blown ed to fix build issues with bc
153 # sed -i -e 's/.*\(CONFIG_ED\).*/#\ \1 is not set/' .config || die
154 #
155 # # use full blown tee from coreutils to fix build errors with smage while logging is enabled
156 # sed -i -e 's/.*\(CONFIG_TEE\).*/#\ \1 is not set/' .config || die
157 #
158 # # use full blown sed stat and date from coreutils to fix segfault issues with i686 and busybox 1.27.x
159 # sed -i -e 's/.*\(CONFIG_SED\).*/#\ \1 is not set/' .config || die
160 # sed -i -e 's/.*\(CONFIG_STAT\).*/#\ \1 is not set/' .config || die
161 # sed -i -e 's/.*\(CONFIG_DATE\).*/#\ \1 is not set/' .config || die
162
163 # now included in config 1.22
164 # # re-enable date, stat, sed
165 # sed -i -e 's/#\ \(CONFIG_DATE\) is not set/\1=y/' \
166 # -e 's/#\ \(CONFIG_FEATURE_DATE_ISOFMT\) is not set/\1=y/' \
167 # -e 's/#\ \(CONFIG_FEATURE_DATE_NANO\) is not set/\1=y/' \
168 # -e 's/#\ \(CONFIG_FEATURE_DATE_COMPAT\) is not set/\1=y/' \
169 # .config || die
170 # sed -i -e 's/#\ \(CONFIG_STAT\) is not set/\1=y/' \
171 # -e 's/#\ \(CONFIG_FEATURE_STAT_FORMAT\) is not set/\1=y/' \
172 # -e 's/#\ \(CONFIG_FEATURE_STAT_FILESYSTEM\) is not set/\1=y/' \
173 # .config || die
174 # sed -i -e 's/#\ \(CONFIG_SED\) is not set/\1=y/' .config || die
175
176 # now included in config-1.22
177 # # build a static busybox with musl
178 # sed -i -e 's/#\ \(CONFIG_STATIC\) is not set/\1=y/' .config || die
179 #
180 # # these vi options breaks with musl-gcc
181 # sed -i -e 's/.*\(CONFIG_FEATURE_VI_8BIT\).*/#\ \1 is not set/' \
182 # -e 's/.*\(CONFIG_FEATURE_VI_REGEX_SEARCH\).*/#\ \1 is not set/' \
183 # .config || die
184
185 # use solib busybox build with system gcc to try to fix some i686 segfaults
186 sed -i -e 's/#\ \(CONFIG_STATIC\)=y/\1 is not set/' .config || die
187 }
188
189 src_compile()
190 {
191 cd ${SRCDIR}
192
193 # fortify_source not supported
194 export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
195
196 make oldconfig || die
197 mmake -j1 V=1 || die
198
199 # create a busybox.links file
200 HOSTCC=gcc sh applets/busybox.mkll | sort > busybox.links || die
201
202 # now included in config 1.19
203 # # do not use ash as default sh, we want bin/bash
204 # sed -i '/bin\/sh$/d' busybox.links || die
205
206 # setfont resides in /bin on newer systems
207 sed -i 's:/sbin/setfont:/bin/setfont:' busybox.links || die
208
209 # honor usr move
210 sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die
211
212 # build nologin program
213 gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die
214 }
215
216 src_install()
217 {
218 cd ${SRCDIR}
219
220 minstallexec busybox || die
221 # set suid bit for suid applets like su
222 mchmod +s /usr/bin/busybox || die
223
224 minstalldir /usr/share/busybox || die
225 minstallfile busybox.links /usr/share/busybox || die
226
227 # systemd needs the keymaps in /usr/share/kbd/keymaps and no! symlinks are allowed
228 # keymaps must end with .map or .map.gz
229 # dracut uses /usr/share/kbd/keymaps too
230 minstalldir /usr/share/kbd/keymaps || die
231 minstallfile de.kmap /usr/share/kbd/keymaps/de.map || die
232
233 minstalldir /usr/share/udhcpc || die
234 minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die
235
236 # install example udhcpd.conf
237 minstalletc examples/udhcp/udhcpd.conf || die
238
239 # install initsystem services
240 minstallunit crond.service || die
241 minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die
242
243 # install server system services
244 # udhcpd
245 minstallunit udhcpd.service-${UDHCPD_SVC_REV} udhcpd.service || die
246 minstallconf udhcpd.confd udhcpd || die
247 minstalltmp udhcpd.tmpfilesd udhcpd.conf || die
248 # tftpd
249 minstallunit tftpd.service-${TFTPD_SVC_REV} tftpd.service || die
250 minstallunit tftpd.socket || die
251 minstallconf tftpd.confd-${TFTPD_CONFD_REV} tftpd || die
252 minstalltmp tftpd.tmpfilesd tftpd.conf || die
253 # httpd
254 minstallunit httpd.service-${HTTPD_SVC_REV} httpd.service || die
255 minstallconf httpd.confd httpd || die
256 minstalltmp httpd.tmpfilesd httpd.conf || die
257
258 # loadkeys emulation script
259 minstallexec -s loadkeys.sh-${LOADKEYS_REV} /usr/bin/loadkeys || die
260
261 # agetty emulation script
262 minstalldir /usr/sbin || die
263 minstallexec -s agetty.sh-${AGETTY_REV} /usr/sbin/agetty || die
264
265 # autologin helper script
266 minstallexec -s autologin.sh /usr/sbin/autologin || die
267
268 # install service configuration files and keep needed directories
269 mkeepdir /var/spool/cron/crontabs || die
270
271 # install a busybox compilant zgrep script, at least needed by plymouth
272 minstallexec -s zgrep.sh /usr/bin/zgrep || die
273
274 # install consolefont and trans from kbd-1.15.5 to fully emulate kbd
275 # for systemd without any configfile changes
276 # busybox cmds requires the base name without any extension, we provide symlinks for systemd
277 minstalldir /usr/share/kbd/consolefonts || die
278 minstallfile lat9w-16.psfu /usr/share/kbd/consolefonts/lat9w-16 || die
279 mlink lat9w-16 /usr/share/kbd/consolefonts/lat9w-16.psfu || die
280 minstallfile LatArCyrHeb-16.psfu /usr/share/kbd/consolefonts/LatArCyrHeb-16 || die
281 mlink LatArCyrHeb-16 /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu || die
282 minstalldir /usr/share/kbd/consoletrans || die
283 minstallfile -s 8859-1_to_uni.trans /usr/share/kbd/consoletrans/8859-1_to_uni || die
284 mlink 8859-1_to_uni /usr/share/kbd/consoletrans/8859-1_to_uni.trans || die
285
286 # install nologin program
287 minstalldir /usr/sbin || die
288 minstallexec nologin /usr/sbin/nologin || die
289
290 # install unimaps directory and a README to suppress warning messages by dracut
291 minstalldir /usr/share/kbd/unimaps || die
292 MCONFIG=/usr/share/kbd/unimaps/README
293 mclearconfig || die
294 maddconfig '# This directory only exist for compatibility reasons' || die
295
296 # install login.defs to satisfy meson
297 minstalldir /etc || die
298 MCONFIG=/etc/login.defs
299 mclearconfig || die
300 maddconfig '# This file only exist for compatibility reasons' || die
301 }
302
303 postinstall()
304 {
305 if [ -x ${MROOT}/usr/bin/busybox ]
306 then
307 echo "Setting suid bit for ${MROOT}/usr/bin/busybox"
308 chmod +s ${MROOT}/usr/bin/busybox
309 fi
310
311 if [ -f ${MROOT}/usr/share/busybox/busybox.links ]
312 then
313 echo "Setting up busybox links ... "
314 local i
315 for i in $(< ${MROOT}/usr/share/busybox/busybox.links)
316 do
317 ln -snf /usr/bin/busybox ${MROOT}/${i}
318 done
319 fi
320 }