Magellan Linux

Contents of /smage/trunk/core/busybox/busybox-1.20.2-r27.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5650 - (show annotations) (download)
Tue May 13 11:46:59 2014 UTC (10 years, 1 month ago) by niro
File size: 10822 byte(s)
-fixed spelling
1 # $Id$
2
3 PNAME="busybox"
4 PVER="1.20.2"
5 PBUILD="r27"
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/ed
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/wget
36 virtual/xz-utils"
37
38 # busbox config revision
39 CFG_REV=1.16
40 # udhcpc client script revision
41 UDHCPC_REV=1.1
42 # busybox.tmpfilesd revision
43 TMP_REV=1.2
44 # agetty emulation script revision
45 AGETTY_REV=1.3
46 # loadkeys emualtion script revision
47 LOADKEYS_REV=1.3
48
49 SRCFILE="${PNAME}-${PVER}.tar.bz2"
50 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
51
52 sminclude mtools systemd alx
53
54 # shared busybox needs glibc and overwrite systemd dep pulled by systemd include
55 DEPEND=">= virtual/glibc"
56
57 SRC_URI=(
58 http://www.busybox.net/downloads/${SRCFILE}
59 mirror://${PNAME}/${SRCFILE}
60 mirror://${PNAME}/config-${CFG_REV}
61 mirror://${PNAME}/udhcpc.sh-${UDHCPC_REV}
62 mirror://${PNAME}/de.kmap.gz
63 mirror://${PNAME}/zgrep.sh
64 mirror://${PNAME}/nologin.c
65 mirror://${PNAME}/crond.service
66 mirror://${PNAME}/busybox.tmpfilesd-${TMP_REV}
67 mirror://${PNAME}/loadkeys.sh-${LOADKEYS_REV}
68 mirror://${PNAME}/agetty.sh-${AGETTY_REV}
69 mirror://${PNAME}/autologin.sh
70 mirror://${PNAME}/lat9w-16.psfu.gz
71 mirror://${PNAME}/LatArCyrHeb-16.psfu.gz
72 mirror://${PNAME}/8859-1_to_uni.trans
73 mirror://${PNAME}/${PNAME}-1.15.3-flags.patch
74 mirror://${PNAME}/${PNAME}-${PVER}-mv-ignore-verbose.patch
75 mirror://${PNAME}/${PNAME}-${PVER}-cp-ignore-onefilesystem.patch
76 mirror://${PNAME}/${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch
77 mirror://${PNAME}/${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch
78 mirror://${PNAME}/${PNAME}-${PVER}-set-up-RO-loop-device.patch
79 mirror://${PNAME}/${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch
80 mirror://${PNAME}/${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch
81 mirror://${PNAME}/${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch
82 mirror://${PNAME}/${PNAME}-${PVER}-support-strictatime-option.patch
83 mirror://${PNAME}/${PNAME}-${PVER}-no-send-signals.patch
84 mirror://${PNAME}/${PNAME}-${PVER}-kernel_ver.patch
85 mirror://${PNAME}/${PNAME}-${PVER}-pkg-config-selinux.patch
86 mirror://${PNAME}/${PNAME}-${PVER}-sys-resource.patch
87 mirror://${PNAME}/${PNAME}-${PVER}-ntpd.patch
88 mirror://${PNAME}/${PNAME}-${PVER}-f2fs.patch
89 mirror://${PNAME}/${PNAME}-${PVER}-xz-multiple-streams.patch
90 )
91
92 src_prepare()
93 {
94 munpack ${SRCFILE} || die
95 munpack de.kmap.gz ${SRCDIR} || die
96 munpack lat9w-16.psfu.gz ${SRCDIR} || die
97 munpack LatArCyrHeb-16.psfu.gz ${SRCDIR} || die
98 cd ${SRCDIR}
99
100 # official patches
101 # tar: support xz -J --xz option
102 mpatch ${PNAME}-${PVER}-tar-support-explicit-xz-compression-option.patch || die
103 # use common defines, needed by mount patches
104 mpatch ${PNAME}-${PVER}-use-common-bb_e2fs_defs.h-for-ext2_3_4-constants-and-structs.patch || die
105 # fix missing loop device
106 mpatch ${PNAME}-${PVER}-set-up-RO-loop-device.patch || die
107 # fix ext2 breakage with ext4 drivers
108 mpatch ${PNAME}-${PVER}-fix-the-wrongly-stored-fs-creation-time-3.patch || die
109 # fix mount
110 mpatch ${PNAME}-${PVER}-undo-recent-breakage-when-mount-flags-were-made-unsigned.patch || die
111 # systemd adds comments to fstab
112 mpatch ${PNAME}-${PVER}-do-not-pass-comment_ANYTHING-mount-option-to-kernel.patch || die
113 # mount: support strictatime option (needed by dracut)
114 mpatch ${PNAME}-${PVER}-support-strictatime-option.patch || die
115 # fix uname
116 mpatch ${PNAME}-${PVER}-kernel_ver.patch || die
117 # fix build against newer selinux
118 mpatch ${PNAME}-${PVER}-pkg-config-selinux.patch || die
119 # fix build against newer glibc (>=2.16) / official patch
120 mpatch ${PNAME}-${PVER}-sys-resource.patch || die
121 # fix ntpd issues
122 mpatch ${PNAME}-${PVER}-ntpd.patch || die
123 # fix xz multiple streams bug
124 # see: https://bugs.busybox.net/show_bug.cgi?id=5804
125 # and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686502
126 mpatch ${PNAME}-${PVER}-xz-multiple-streams.patch || die
127
128 # magellan patches
129 # remove broken cflags
130 mpatch ${PNAME}-1.15.3-flags.patch || die
131 # let mv ignore the verbose mode switch (mv -v prints an error)
132 mpatch ${PNAME}-${PVER}-mv-ignore-verbose.patch || die
133 # let cp ignore the onefilesystem mode switch (cp -x prints an error)
134 mpatch ${PNAME}-${PVER}-cp-ignore-onefilesystem.patch || die
135 # do not send any signals on shutdown/reboot, we doing this via sendsignals rc
136 mpatch ${PNAME}-${PVER}-no-send-signals.patch || die
137 # fix libvolume_id to support f2fs
138 mpatch ${PNAME}-${PVER}-f2fs.patch || die
139
140 # using a custom config
141 cp ${SOURCEDIR}/${PNAME}/config-${CFG_REV} .config || die
142
143 # disable fbsplash
144 sed -i -e 's/.*\(CONFIG_FBSPLASH\).*/#\ \1 is not set/' \
145 -e 's/.*\(CONFIG_FEATURE_FBSPLASH_8BPP\).*/#\ \1 is not set/' \
146 -e 's/.*\(CONFIG_FEATURE_FBSPLASH_SPRITES\).*/#\ \1 is not set/' \
147 -e 's/.*\(CONFIG_FEATURE_FBSPLASH_TEXT\).*/#\ \1 is not set/' \
148 -e 's/.*\(CONFIG_FEATURE_FBSPLASH_FONTLOAD\).*/#\ \1 is not set/' \
149 .config || die
150
151 # socket activation support
152 echo "CONFIG_FEATURE_SYSTEMD=y" >> .config || die
153
154 # setfont should use kbd resources in /usr/share (consolefonts, consoletrans etc)
155 sed -i 's:.*\(CONFIG_DEFAULT_SETFONT_DIR\).*:\1="/usr/share":' .config || die
156
157 # disable syslogd in favor of journald
158 sed -i -e 's/.*\(CONFIG_SYSLOGD\).*/#\ \1 is not set/' \
159 -e 's/.*\(CONFIG_FEATURE_ROTATE_LOGFILE\).*/#\ \1 is not set/' \
160 -e 's/.*\(CONFIG_FEATURE_REMOTE_LOG\).*/#\ \1 is not set/' \
161 -e 's/.*\(CONFIG_FEATURE_SYSLOGD_DUP\).*/#\ \1 is not set/' \
162 -e 's/.*\(CONFIG_FEATURE_SYSLOGD_CFG\).*/#\ \1 is not set/' \
163 -e 's/.*\(CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE\).*/\1=0/' \
164 -e 's/.*\(CONFIG_FEATURE_IPC_SYSLOG\).*/#\ \1 is not set/' \
165 -e 's/.*\(CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE\).*/\1=0/' \
166 -e 's/.*\(CONFIG_LOGREAD\).*/#\ \1 is not set/' \
167 -e 's/.*\(CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING\).*/#\ \1 is not set/' \
168 .config || die
169 }
170
171 src_compile()
172 {
173 cd ${SRCDIR}
174
175 make oldconfig || die
176 mmake || die
177
178 # create a busybox.links file
179 HOSTCC=gcc sh applets/busybox.mkll | sort > busybox.links || die
180
181 # do not use ash as default sh, we want bin/bash
182 sed -i '/bin\/sh$/d' busybox.links || die
183
184 # remove some applet symlinks which are provided by other packages
185 ### patch
186 sed -i '/usr\/bin\/patch$/d' busybox.links || die
187 ### e2fsprogs
188 sed -i '/sbin\/fsck$/d' busybox.links || die
189 sed -i '/sbin\/mke2fs$/d' busybox.links || die
190 sed -i '/sbin\/mkfs.ext2$/d' busybox.links || die
191 sed -i '/sbin\/tune2fs$/d' busybox.links || die
192 ### binutils
193 sed -i '/usr\/bin\/ar$/d' busybox.links || die
194 sed -i '/usr\/bin\/strings$/d' busybox.links || die
195 ### diffutils
196 sed -i '/usr\/bin\/cmp$/d' busybox.links || die
197 ### umount (use from util-linux, need -t option)
198 sed -i '/bin\/umount$/d' busybox.links || die
199 ### mount (systemd needs a full featured version)
200 sed -i '/bin\/mount$/d' busybox.links || die
201
202 # provided by systemd
203 sed -i '/sbin\/init$/d' busybox.links || die
204 sed -i '/sbin\/reboot$/d' busybox.links || die
205 sed -i '/sbin\/halt$/d' busybox.links || die
206 sed -i '/sbin\/poweroff$/d' busybox.links || die
207 sed -i '/sbin\/runlevel$/d' busybox.links || die
208
209 # collides with dracut network module
210 sed -i '/sbin\/ifup$/d' busybox.links || die
211 sed -i '/sbin\/ifdown$/d' busybox.links || die
212
213 # use ln of coreutils to support --relative option
214 sed -i '/bin\/ln$/d' busybox.links || die
215
216 # setfont resides in /bin on newer systems
217 sed -i 's:/sbin/setfont:/bin/setfont:' busybox.links || die
218
219 # honor usr move
220 sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die
221
222 # build nologin program
223 gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die
224 }
225
226 src_install()
227 {
228 cd ${SRCDIR}
229
230 minstallexec busybox || die
231 # set suid bit for suid applets like su
232 mchmod +s /usr/bin/busybox || die
233
234 minstalldir /usr/share/busybox || die
235 minstallfile busybox.links /usr/share/busybox || die
236
237 # systemd needs the keymaps in /usr/share/keymaps and no! symlinks are allowed
238 # keymaps must end with .map or .map.gz
239 # dracut uses /usr/share/keymaps too
240 minstalldir /usr/share/keymaps || die
241 minstallfile de.kmap /usr/share/keymaps/de.map || die
242
243 minstalldir /usr/share/udhcpc || die
244 minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die
245
246 # install initsystem services
247 minstallunit crond.service || die
248 minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die
249
250 # loadkeys emulation script
251 minstallexec -s loadkeys.sh-${LOADKEYS_REV} /usr/bin/loadkeys || die
252
253 # agetty emulation script
254 minstalldir /usr/sbin || die
255 minstallexec -s agetty.sh-${AGETTY_REV} /usr/sbin/agetty || die
256
257 # autologin helper script
258 minstallexec -s autologin.sh /usr/sbin/autologin || die
259
260 # install service configuration files and keep needed directories
261 mkeepdir /var/spool/cron/crontabs || die
262
263 # install a busybox compilant zgrep script, at last needed by plymouth
264 minstallexec -s zgrep.sh /usr/bin/zgrep || die
265
266 # install consolefont and trans from kbd-1.15.5 to fully emulate kbd
267 # to support systemd without any configfile changes
268 # busybox cmds requires the base name without any extension, we provide symlinks for systemd
269 minstalldir /usr/share/consolefonts || die
270 minstallfile lat9w-16.psfu /usr/share/consolefonts/lat9w-16 || die
271 mlink lat9w-16 /usr/share/consolefonts/lat9w-16.psfu || die
272 minstallfile LatArCyrHeb-16.psfu /usr/share/consolefonts/LatArCyrHeb-16 || die
273 mlink LatArCyrHeb-16 /usr/share/consolefonts/LatArCyrHeb-16.psfu || die
274 minstalldir /usr/share/consoletrans || die
275 minstallfile -s 8859-1_to_uni.trans /usr/share/consoletrans/8859-1_to_uni || die
276 mlink 8859-1_to_uni /usr/share/consoletrans/8859-1_to_uni.trans || die
277
278 # install nologin program
279 minstalldir /usr/sbin || die
280 minstallexec nologin /usr/sbin/nologin || die
281
282 # install unimaps directory and a README to suppress warning messages by dracut
283 minstalldir /usr/share/unimaps || die
284 MCONFIG=/usr/share/unimaps/README || die
285 mclearconfig || die
286 maddconfig '# This directory only exist for compatibility reasons' || die
287 }
288
289 postinstall()
290 {
291 if [ -x ${MROOT}/usr/bin/busybox ]
292 then
293 echo "Setting suid bit for ${MROOT}/usr/bin/busybox"
294 chmod +s ${MROOT}/usr/bin/busybox
295 fi
296
297 if [ -f ${MROOT}/usr/share/busybox/busybox.links ]
298 then
299 echo "Setting up busybox links ... "
300 local i
301 for i in $(< ${MROOT}/usr/share/busybox/busybox.links)
302 do
303 ln -snf /usr/bin/busybox ${MROOT}/${i}
304 done
305 fi
306 }