Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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