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
|
Name: toybox
Version: 0.6.0
Release: 1%{?dist}
Summary: Single binary providing simplified versions of system commands
Group: Base/Utilities
License: BSD-2.0
URL: http://www.landley.net/toybox/
Source: %{name}-%{version}.tar.bz2
Source1: config
Source2: bin.links
Source3: sbin.links
Source4: usrbin.links
Source5: usrsbin.links
Source1001: toybox.manifest
BuildRequires : smack-devel
BuildRequires : libattr-devel
%description
Toybox 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 symlinks-dhcp
Group: Base/Utilities
Summary: ToyBox symlinks to provide 'dhcp'
Requires: %{name} = %{version}-%{release}
%description symlinks-dhcp
ToyBox symlinks for utilities corresponding to 'dhcp' package.
%package symlinks-dhcpd
Group: Base/Utilities
Summary: ToyBox symlinks to provide 'dhcpd'
Requires: %{name} = %{version}-%{release}
%description symlinks-dhcpd
ToyBox symlinks for utilities corresponding to 'dhcpd' package.
%package symlinks-ping
Group: Base/Utilities
Summary: ToyBox symlinks to provide 'ping'
Requires: %{name} = %{version}-%{release}
%description symlinks-ping
ToyBox symlinks for utilities corresponding to 'ping' package.
%package symlinks-ping6
Group: Base/Utilities
Summary: ToyBox symlinks to provide 'ping6'
Requires: %{name} = %{version}-%{release}
%description symlinks-ping6
ToyBox symlinks for utilities corresponding to 'ping6' package.
%package symlinks-nslookup
Group: Base/Utilities
Summary: ToyBox symlinks to provide 'nslookup'
Requires: %{name} = %{version}-%{release}
%description symlinks-nslookup
ToyBox symlinks for utilities corresponding to 'nslookup' package.
%prep
%setup -q
%build
cp %{SOURCE1001} .
# create dynamic toybox - the executable is toybox
cp %{SOURCE1} .config
make -j 4 CC="gcc $RPM_OPT_FLAGS" CFLAGS="$CFLAGS -fPIE" LDOPTIMIZE="-Wl,--gc-sections -pie"
cp toybox toybox-dynamic
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/bin
mkdir -p $RPM_BUILD_ROOT/sbin
install -m 755 toybox-dynamic $RPM_BUILD_ROOT/bin/toybox
# debian/toybox.links
pushd %{buildroot}
mkdir -p usr/bin usr/sbin sbin
cd bin
for f in `cat %SOURCE2` ; do ln -s toybox $f ; done
cd ../sbin
for f in `cat %SOURCE3` ; do ln -s ../bin/toybox $f ; done
cd ../usr/bin
for f in `cat %SOURCE4` ; do ln -s ../../bin/toybox $f ; done
cd ../../usr/sbin
for f in `cat %SOURCE5` ; do ln -s ../../bin/toybox $f ; done
popd
%files
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
/bin/toybox
%files symlinks-dhcp
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/dhcp
%files symlinks-dhcpd
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/dumpleases
%{_sbindir}/dhcpd
%files symlinks-ping
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/ping
%files symlinks-ping6
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/ping6
%files symlinks-nslookup
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/nslookup
|