Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5319 - (show annotations) (download)
Mon Dec 23 14:34:31 2013 UTC (10 years, 6 months ago) by niro
File size: 10050 byte(s)
-fixed a typo
1 # $Id$
2
3 PNAME="busybox"
4 PVER="1.20.2"
5 PBUILD="r21"
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 # shared busybox needs glibc
13 DEPEND=">= virtual/glibc"
14
15 PROVIDE="virtual/bzip2
16 virtual/cron
17 virtual/debianutils
18 virtual/dhcp
19 virtual/ed
20 virtual/eject
21 virtual/grep
22 virtual/gzip
23 virtual/inetutils
24 virtual/kbd
25 irtual/less
26 virtual/net-tools
27 virtual/pciutils
28 virtual/procps
29 virtual/psmisc
30 virtual/sed
31 virtual/shadow
32 virtual/sysvinit
33 virtual/sysvinit-tools
34 virtual/tar
35 virtual/unzip
36 virtual/usbutils
37 virtual/which
38 virtual/wget
39 virtual/xz-utils"
40
41 # busbox config revision
42 CFG_REV=1.16
43 # udhcpc client script revision
44 UDHCPC_REV=1.1
45 # busybox.tmpfilesd revision
46 TMP_REV=1.2
47 # agetty emulation script revision
48 AGETTY_REV=1.3
49 # loadkeys emualtion script revision
50 LOADKEYS_REV=1.2
51
52 SRCFILE="${PNAME}-${PVER}.tar.bz2"
53 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
54
55 sminclude mtools systemd alx
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 # setfont resides in /bin on newer systems
205 sed -i 's:/sbin/setfont:/bin/setfont:' busybox.links || die
206
207 # honor usr move
208 sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die
209
210 # build nologin program
211 gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die
212 }
213
214 src_install()
215 {
216 cd ${SRCDIR}
217
218 minstallexec busybox || die
219 # set suid bit for suid applets like su
220 mchmod +s /usr/bin/busybox || die
221
222 minstalldir /usr/share/busybox || die
223 minstallfile busybox.links /usr/share/busybox || die
224
225 # systemd needs the keymaps in /usr/share/keymaps and no! symlinks are allowed
226 # keymaps must end with .map or .map.gz
227 # dracut uses /usr/share/keymaps too
228 minstalldir /usr/share/keymaps || die
229 minstallfile de.kmap /usr/share/keymaps/de.map || die
230
231 minstalldir /usr/share/udhcpc || die
232 minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die
233
234 # install initsystem services
235 minstallunit crond.service || die
236 minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die
237
238 # loadkeys emulation script
239 minstallexec -s loadkeys.sh-${LOADKEYS_REV} /usr/bin/loadkeys || die
240
241 # agetty emulation script
242 minstalldir /usr/sbin || die
243 minstallexec -s agetty.sh-${AGETTY_REV} /usr/sbin/agetty || die
244
245 # autologin helper script
246 minstallexec -s autologin.sh /usr/sbin/autologin || die
247
248 # install service configuration files and keep needed directories
249 mkeepdir /var/spool/cron/crontabs || die
250
251 # install a busybox compilant zgrep script, at last needed by plymouth
252 minstallexec -s zgrep.sh /usr/bin/zgrep || die
253
254 # install consolefont and trans from kbd-1.15.5 to fully emulate kbd
255 # for systemd without any configfile changes
256 minstalldir /usr/share/consolefonts || die
257 minstallfile lat9w-16.psfu /usr/share/consolefonts || die
258 minstallfile LatArCyrHeb-16.psfu /usr/share/consolefonts || die
259 minstalldir /usr/share/consoletrans || die
260 minstallfile -s 8859-1_to_uni.trans /usr/share/consoletrans || die
261
262 # install nologin program
263 minstalldir /usr/sbin || die
264 minstallexec nologin /usr/sbin/nologin || die
265
266 # install unimaps directory and a README to suppress warning messages by dracut
267 minstalldir /usr/share/unimaps || die
268 MCONFIG=/usr/share/unimaps/README || die
269 mclearconfig || die
270 maddconfig '# This directory only exist for compatibility reasons' || die
271 }
272
273 postinstall()
274 {
275 if [ -x ${MROOT}/usr/bin/busybox ]
276 then
277 echo "Setting suid bit for ${MROOT}/usr/bin/busybox"
278 chmod +s ${MROOT}/usr/bin/busybox
279 fi
280
281 if [ -f ${MROOT}/usr/share/busybox/busybox.links ]
282 then
283 echo "Setting up busybox links ... "
284 local i
285 for i in $(< ${MROOT}/usr/share/busybox/busybox.links)
286 do
287 ln -snf /usr/bin/busybox ${MROOT}/${i}
288 done
289 fi
290
291 # run services *after* creating the busybox symlinks!
292 mstartunit crond.service
293 }
294
295 postremove()
296 {
297 mstopunit crond.service
298 }