Magellan Linux

Contents of /smage/trunk/core/busybox/busybox-1.27.2-r5.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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