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
|
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
Source11: config-full
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 full
Group: Base/Utilities
Summary: ToyBox that includes all applets including init.
Conflicts: %{name}
%description full
Toybox-full is a single binary which includes most of the applets
including 'init' command.
%package symlinks-full
Group: Base/Utilities
Summary: ToyBox symlinks to provide all applets
Requires: %{name}-full = %{version}-%{release}
%description symlinks-full
ToyBox symlinks for utilities corresponding to all packages.
%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 a minimum dynamic toybox (ELF) that consists of 'nslookup', 'ping', and 'dhcpd'.
cp %{SOURCE1} .config
make -j 4 CC="gcc $RPM_OPT_FLAGS" CFLAGS="$CFLAGS -fPIE" LDOPTIMIZE="-Wl,--gc-sections -pie"
cp toybox toybox-dynamic
# create a dynamic toybox-full (ELF) that include most of the applets including 'init'.
cp %{SOURCE11} .config
make -j 4 CC="gcc $RPM_OPT_FLAGS" CFLAGS="$CFLAGS -fPIE" LDOPTIMIZE="-Wl,--gc-sections -pie"
cp toybox toybox-dynamic-full
%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
install -m 755 toybox-dynamic-full $RPM_BUILD_ROOT/bin/toybox-full
# 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
%post full
/bin/toybox-full ln -s /bin/toybox-full /bin/toybox
%files
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
/bin/toybox
%files full
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
/bin/toybox-full
%files symlinks-full
%manifest toybox.manifest
%license LICENSE.BSD
%defattr(-,root,root,-)
%{_bindir}/*
%{_sbindir}/*
%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
%changelog
* Mon May 27 2019 Geunsik Lim <geunsik.lim@samsung.com>
- Added toybox-full that consists of most applets
|