Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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