/
busybox.spec
437 lines (384 loc) · 8.57 KB
/
busybox.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
Summary: Single binary providing simplified versions of system commands
Name: busybox
Version: 1.31.0
Release: 1
License: GPLv2
Source0: http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2
Source1: rpm/udhcpd.service
Source2: busybox-static.config
Source3: busybox-sailfish.config
Patch0: 0001-Copy-extended-attributes-if-p-flag-is-provided-to-cp.patch
Patch1: 0002-applets-Busybox-in-usr-bin-instead-of-bin.patch
URL: https://git.sailfishos.org/mer-core/busybox
BuildRequires: glibc-static
BuildRequires: libselinux-static libsepol-static
BuildRequires: pcre-static
Obsoletes: time <= 1.7
Provides: time > 1.7
# Providing only part of iputils, but should be enough for us.
Obsoletes: iputils <= 20101006
Provides: iputils > 20101006
%define debug_package %{nil}
%description
Busybox is a single binary which includes versions of a large number
of system commands, including a shell. This package can be very
useful for recovering from certain types of system failures,
particularly those involving broken shared libraries.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
Obsoletes: %{name}-docs
%description doc
Busybox user guide.
%package static
Summary: Statically linked version of busybox
%description static
Busybox is a single binary which includes versions of a large number
of system commands, including a shell. This package can be very
useful for recovering from certain types of system failures,
particularly those involving broken shared libraries. This package provides
a statically linked version of Busybox.
%package symlinks-coreutils
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacements for coreutils
Conflicts: gnu-coreutils
Provides: coreutils = 1:6.9+git1
Obsoletes: coreutils < 1:6.9+git1
Provides: mktemp
%description symlinks-coreutils
%{summary} as symlinks.
%package symlinks-dosfstools
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacements for dosfstools
%description symlinks-dosfstools
%{summary} as symlinks.
%package symlinks-gzip
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for gzip
Provides: gzip
%description symlinks-gzip
%{summary} as symlinks.
%package symlinks-dhcp
Requires: %{name} = %{version}-%{release}
Summary: Busybox dhcp utilities
%description symlinks-dhcp
%{summary} as symlinks (udhcpc/udhcpcd).
%package symlinks-diffutils
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacements for diffutils
Provides: diffutils
Conflicts: gnu-diffutils
%description symlinks-diffutils
%{summary} as symlinks.
%package symlinks-findutils
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacements for findutils
Provides: findutils
Conflicts: gnu-findutils
%description symlinks-findutils
%{summary} as symlinks.
%package symlinks-grep
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for grep
Provides: grep
Provides: /bin/grep
Conflicts: gnu-grep
%description symlinks-grep
%{summary} as symlinks (grep, egrep, fgrep).
%package symlinks-cpio
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for cpio
Provides: cpio
Conflicts: gnu-cpio
%description symlinks-cpio
%{summary} as symlinks.
%package symlinks-tar
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for tar
Provides: tar
Conflicts: gnu-tar
%description symlinks-tar
%{summary} as symlinks.
%package symlinks-vi
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for vi
Provides: vi
Conflicts: vim-minimal
%description symlinks-vi
%{summary} as symlinks.
%package symlinks-which
Requires: %{name} = %{version}-%{release}
Summary: Busybox replacement for which
Provides: which
Conflicts: util-linux <= 2.33+git1
%description symlinks-which
%{summary} as symlinks.
%prep
%setup -q -n %{name}-%{version}/upstream
%patch0 -p1
%patch1 -p1
%build
# TODO: This config should be synced with the dynamic config at some point
# currently the features differ quite a bit
cp %{SOURCE2} .config
yes "" | make oldconfig
make %{?_smp_mflags}
cp busybox busybox-static
# clean any leftovers from static build
make clean
make distclean
# Build dynamic version
cp %{SOURCE3} .config
yes "" | make oldconfig
make %{_smp_mflags}
make busybox.links
# /bin links are legacy, use /usr/bin whenever you can
cat >> busybox.links << EOF
/bin/busybox
%{_bindir}/ping
%{_bindir}/ping6
%{_sbindir}/mkdosfs
%{_sbindir}/mkfs.vfat
%{_bindir}/gzip
%{_bindir}/gunzip
%{_bindir}/zcat
%{_sbindir}/udhcpc
/bin/find
%{_bindir}/grep
%{_bindir}/egrep
%{_bindir}/fgrep
%{_bindir}/cpio
%{_bindir}/tar
%{_bindir}/vi
/bin/basename
/bin/cut
/bin/env
/bin/sort
%{_bindir}/base64
%{_bindir}/cat
%{_bindir}/chgrp
%{_bindir}/chmod
%{_bindir}/chown
%{_bindir}/cp
%{_bindir}/date
%{_bindir}/dd
%{_bindir}/df
%{_bindir}/echo
%{_bindir}/false
%{_bindir}/link
%{_bindir}/ln
%{_bindir}/ls
%{_bindir}/mkdir
%{_bindir}/mknod
%{_bindir}/mktemp
%{_bindir}/mv
%{_bindir}/nice
%{_bindir}/printenv
%{_bindir}/pwd
%{_bindir}/rm
%{_bindir}/rmdir
%{_bindir}/sleep
%{_bindir}/stat
%{_bindir}/stty
%{_bindir}/sync
%{_bindir}/touch
%{_bindir}/true
%{_bindir}/uname
EOF
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/bin
mkdir -p %{buildroot}/usr/bin
install -m 755 busybox %{buildroot}/usr/bin/busybox
install -m 644 -D %{SOURCE1} %{buildroot}/lib/systemd/system/udhcpd.service
applets/install.sh %{buildroot} --symlinks
rm -f %{buildroot}/sbin/udhcpc
# Cleanup some symlinks
rm -f %{buildroot}/bin/base64
install -m 755 busybox-static %{buildroot}/usr/bin/busybox-static
ln -s ../usr/bin/busybox-static %{buildroot}/bin/busybox-static
mkdir -p %{buildroot}/%{_docdir}/%{name}-%{version}
install -m 644 -t %{buildroot}/%{_docdir}/%{name}-%{version} \
docs/BusyBox.html docs/BusyBox.txt
%files
%defattr(-,root,root,-)
%license LICENSE
/bin/busybox
%{_bindir}/busybox
/bin/ping
%{_bindir}/ping
/bin/ping6
%{_bindir}/ping6
%{_bindir}/time
%{_bindir}/traceroute
%{_bindir}/traceroute6
%{_sbindir}/arping
%files static
%defattr(-,root,root,-)
/bin/busybox-static
%{_bindir}/busybox-static
%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-%{version}
%files symlinks-coreutils
%defattr(-,root,root,-)
/bin/basename
/bin/cat
/bin/chgrp
/bin/chmod
/bin/chown
/bin/cp
/bin/cut
/bin/date
/bin/dd
/bin/df
/bin/echo
/bin/env
/bin/false
/bin/link
/bin/ln
/bin/ls
/bin/mkdir
/bin/mknod
/bin/mktemp
/bin/mv
/bin/nice
/bin/printenv
/bin/pwd
/bin/rm
/bin/rmdir
/bin/sleep
/bin/sort
/bin/stat
/bin/stty
/bin/sync
/bin/touch
/bin/true
/bin/uname
%{_bindir}/[
%{_bindir}/base64
%{_bindir}/basename
%{_bindir}/cat
%{_bindir}/chgrp
%{_bindir}/chmod
%{_bindir}/chown
%{_bindir}/cksum
%{_bindir}/comm
%{_bindir}/cp
%{_bindir}/cut
%{_bindir}/date
%{_bindir}/dd
%{_bindir}/df
%{_bindir}/dirname
%{_bindir}/du
%{_bindir}/echo
%{_bindir}/env
%{_bindir}/expand
%{_bindir}/expr
%{_bindir}/factor
%{_bindir}/false
%{_bindir}/fold
%{_bindir}/groups
%{_bindir}/head
%{_bindir}/hostid
%{_bindir}/id
%{_bindir}/install
%{_bindir}/link
%{_bindir}/ln
%{_bindir}/logname
%{_bindir}/ls
%{_bindir}/md5sum
%{_bindir}/mkdir
%{_bindir}/mkfifo
%{_bindir}/mknod
%{_bindir}/mktemp
%{_bindir}/mv
%{_bindir}/nice
%{_bindir}/nl
%{_bindir}/nohup
%{_bindir}/od
%{_bindir}/paste
%{_bindir}/printenv
%{_bindir}/printf
%{_bindir}/pwd
%{_bindir}/readlink
%{_bindir}/rm
%{_bindir}/rmdir
%{_bindir}/seq
%{_bindir}/sha1sum
%{_bindir}/sha256sum
%{_bindir}/sha512sum
%{_bindir}/shred
%{_bindir}/shuf
%{_bindir}/sleep
%{_bindir}/sort
%{_bindir}/split
%{_bindir}/stat
%{_bindir}/stty
%{_bindir}/sum
%{_bindir}/sync
%{_bindir}/tac
%{_bindir}/tail
%{_bindir}/tee
%{_bindir}/test
%{_bindir}/touch
%{_bindir}/tr
%{_bindir}/true
%{_bindir}/tty
%{_bindir}/uname
%{_bindir}/unexpand
%{_bindir}/uniq
%{_bindir}/unlink
%{_bindir}/users
%{_bindir}/wc
%{_bindir}/who
%{_bindir}/whoami
%{_bindir}/yes
%{_sbindir}/chroot
%files symlinks-dosfstools
%defattr(-,root,root,-)
/sbin/mkdosfs
%{_sbindir}/mkdosfs
/sbin/mkfs.vfat
%{_sbindir}/mkfs.vfat
%files symlinks-gzip
%defattr(-,root,root,-)
/bin/gunzip
%{_bindir}/gunzip
/bin/gzip
%{_bindir}/gzip
/bin/zcat
%{_bindir}/zcat
%files symlinks-dhcp
%defattr(-,root,root,-)
%{_sbindir}/udhcpc
%{_sbindir}/udhcpd
/lib/systemd/system/udhcpd.service
%files symlinks-diffutils
%defattr(-,root,root,-)
%{_bindir}/diff
%{_bindir}/cmp
%files symlinks-findutils
%defattr(-,root,root,-)
/bin/find
%{_bindir}/find
%{_bindir}/xargs
%files symlinks-grep
%defattr(-,root,root,-)
/bin/{,e,f}grep
%{_bindir}/{,e,f}grep
%files symlinks-cpio
%defattr(-,root,root,-)
/bin/cpio
%{_bindir}/cpio
%files symlinks-tar
%defattr(-,root,root,-)
/bin/tar
%{_bindir}/tar
%files symlinks-vi
%defattr(-,root,root,-)
/bin/vi
%{_bindir}/vi
%files symlinks-which
%defattr(-,root,root,-)
%{_bindir}/which