wok-6.x view busybox/receipt @ rev 15772
linux-source: install initrd.cpio
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 07 23:03:08 2014 +0000 (2014-01-07) |
parents | 73d80d561b42 |
children | ad05e742684d |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.22.0"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
10 WEB_SITE="http://www.busybox.net/"
11 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
12 HOST_ARCH="i486 arm"
14 DEPENDS="slitaz-base-files glibc-base ncurses-common"
15 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486 \
16 musl-libc-dev dietlibc"
18 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
19 /etc/resolv.conf /etc/httpd.conf"
20 AUFS_NOT_RAMFS="uclibc-cross-compiler-i486 is not compatible with aufs+tmpfs 8("
22 # Handle cross compilation
23 case "$ARCH" in
24 arm) BUILD_DEPENDS="bzip2" ;;
25 esac
27 # Busybox patches
28 apply_bb_patchs()
29 {
30 cd $src
31 while read file; do
32 [ -f done.$file ] && continue
33 echo "Apply $file..."
34 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
35 touch done.$file
36 done <<EOT
37 tar.u
38 stat.u
39 ris.u
40 zmodules.u
41 printable.u
42 cmdline.u
43 diff.u
44 diet.u
45 EOT
46 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
47 }
49 # Rules to configure and make the package.
50 compile_rules()
51 {
52 case "$ARCH" in
53 arm)
54 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
55 apply_bb_patchs &&
56 cp $stuff/arm/$PACKAGE.config .config
57 make oldconfig &&
58 make && make install || return 1
59 chmod 4755 $src/_install/bin/busybox ;;
60 x86_64) echo "TODO" ;;
61 i?86)
62 apply_bb_patchs &&
63 make oldconfig &&
64 make && make install || return 1
65 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
66 $src/_install/bin/busybox
68 # prepare busybox-pam package
69 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
70 make oldconfig && make || return 1
71 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
72 mv busybox busybox-pam
74 # prepare busybox-static package
75 if [ -x /usr/bin/uclibc-i486-gcc ]; then
76 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
77 make oldconfig && make || return 1
78 cp busybox busybox-static
79 mv busybox busybox-uclibc
80 fi
82 if [ -x /usr/bin/musl-gcc ]; then
83 # prepare busybox-musl package
84 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
85 sed -i 's|uclibc-i486-||' .config
86 make oldconfig && make CC=musl-gcc || return 1
87 mv busybox busybox-musl
88 fi
90 if [ -x /usr/lib/diet/bin/diet ]; then
91 # prepare busybox-diet package
92 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
93 sed -i 's|uclibc-i486-||;s|CFLAGS="|&-D_BSD_SOURCE |;s|LDFLAGS="|&-Wl,--allow-multiple-definition |;s|LDLIBS="|&compat rpc |' .config
94 make oldconfig && make CC="/usr/lib/diet/bin/diet gcc" || return 1
95 mv busybox busybox-diet
96 fi
98 # prepare ssfs-busybox package
99 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
100 mkdir -p $rootfs/etc
101 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
102 make oldconfig && make busybox &&
103 make CONFIG_PREFIX=$rootfs install || return 1
104 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
105 chown -R 0.0 $rootfs/etc
106 chmod 0600 $rootfs/etc/busybox.conf
107 chmod 4755 $rootfs/bin/busybox ;;
108 esac
109 }
111 # Cross compilation check.
112 testsuite()
113 {
114 readelf -h $src/_install/bin/busybox
115 }
117 # Rules to gen a SliTaz package suitable for Tazpkg.
118 genpkg_rules()
119 {
120 cp -a $src/_install/* $fs
121 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
122 mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd
124 # Busybox config files.
125 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
126 syslog.conf zcip.script
127 do
128 cp $stuff/$f $fs/etc
129 done
130 chown -R 0.0 $fs/etc
131 chmod 600 $fs/etc/busybox.conf
132 touch $fs/etc/resolv.conf
134 # Daemon scripts.
135 cp $stuff/daemon $fs/etc/init.d
136 DAEMON="crond dnsd ftpd httpd inetd lpd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
137 for i in $DAEMON; do
138 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
139 ln -s daemon $fs/etc/init.d/$i
140 done
141 rm $fs/linuxrc
142 mkdir -p $fs/etc/modprobe.d
144 # Udhcpc stuff.
145 mkdir -p $fs/usr/share/udhcpc
146 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
147 chmod +x $fs/usr/share/udhcpc/default.script
149 # Httpd stuff.
150 ln -s /usr/lib/slitaz/httphelper.sh $fs/usr/bin/httpd_helper.sh
151 cp -a $stuff/www $fs/var
152 }
154 # GNU utils stuff.
155 pre_install()
156 {
157 local i
158 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
159 answer=""
160 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
161 [ -f $1$i ] || continue
162 case "$i" in
163 /bin/busybox) continue ;;
164 *bin/*) ;;
165 *) continue ;;
166 esac
167 if [ -z "$answer" ]; then
168 echo -n "Keep installed GNU utilities ? "
169 read -t 30 answer # by default: keep
170 case "$answer" in
171 n*|N*) break;;
172 *) answer="Y";;
173 esac
174 fi
175 cp -a $1$i $1$i-busybox-install
176 done
177 }
179 post_install()
180 {
181 local i
182 [ -f /etc/resolv.conf-busybox-install ] &&
183 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
184 while read i ; do
185 [ -f $1$i-busybox-install ] || continue
186 mv $1$i-busybox-install $1$i
187 done < $1$INSTALLED/$PACKAGE/files.list
188 chmod 4755 $1/bin/busybox
190 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
191 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
192 echo '# Domain name server options.' >> $root/etc/daemons.conf
193 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
194 echo '' >> $root/etc/daemons.conf
195 fi
196 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
197 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
198 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
199 echo '' >> $root/etc/daemons.conf
200 fi
201 }
203 pre_remove()
204 {
205 # We can not remove this package !
206 exit 1
207 }