Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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