wok-current view busybox/receipt @ rev 12893
Up busybox (1.20.1)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon May 28 10:03:33 2012 +0200 (2012-05-28) |
parents | 198bdfe3af18 |
children | 61ad9c3b0a5a |
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.20.1"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://www.busybox.net/"
10 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
11 HOST_ARCH="i486 arm"
13 DEPENDS="slitaz-base-files glibc-base ncurses-common"
14 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486"
15 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
16 /etc/resolv.conf /etc/httpd.conf"
17 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-i486 is not compatible with aufs 8("
19 case "$ARCH" in
20 arm) BUILD_DEPENDS="bzip2" ;;
21 esac
23 apply_bb_patchs()
24 {
25 cd $src
26 while read file; do
27 [ -f done.$file ] && continue
28 echo "Apply $file..."
29 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
30 touch done.$file
31 done <<EOT
32 tar.u
33 stat.u
34 ris.u
35 zmodules.u
36 printable.u
37 cmdline.u
38 su-nochdir.u
39 diff.u
40 EOT
41 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
42 }
44 # Rules to compile & install the temporary toolchain.
45 cook_tmp_toolchain()
46 {
47 { stuff=${stuff:-../stuff}
48 apply_bb_patchs &&
49 make oldconfig &&
50 make &&
51 make CONFIG_PREFIX=/tools install
52 } || return 1
53 echo "Chmod 4755 on busybox binary..."
54 chmod 4755 /tools/bin/busybox
55 }
57 # Cook Busybox
58 cook_bb()
59 {
60 { apply_bb_patchs &&
61 make oldconfig &&
62 make && make install
63 } || return 1
64 }
66 # Rules to configure and make the package.
67 compile_rules()
68 {
69 case "$ARCH" in
70 arm)
71 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
72 cook_bb
73 chmod 4755 $src/_install/bin/busybox ;;
74 x86_64) echo "TODO" ;;
75 i?86)
76 cook_bb
77 strip --strip-unneeded \
78 -R .eh_frame -R .eh_frame_hdr \
79 $src/_install/bin/busybox
81 # prepare busybox-pam package
82 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
83 make oldconfig && make || return 1
84 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
85 mv busybox busybox-pam
87 # prepare busybox-static package
88 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
89 make oldconfig && make || return 1
90 mv busybox busybox-static
92 # prepare ssfs-busybox package
93 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
94 mkdir -p $rootfs/etc
95 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
96 make oldconfig && make busybox &&
97 make CONFIG_PREFIX=$rootfs install || return 1
98 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
99 chown -R 0.0 $rootfs/etc
100 chmod 0600 $rootfs/etc/busybox.conf
101 chmod 4755 $rootfs/bin/busybox ;;
102 esac
103 }
105 # Cross compilation check.
106 testsuite()
107 {
108 readelf -h $src/_install/bin/busybox
109 }
111 # Rules to gen a SliTaz package suitable for Tazpkg.
112 genpkg_rules()
113 {
114 cp -a $src/_install/* $fs
115 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
116 mkdir -p $fs/etc/init.d $fs/var
118 # Busybox config files.
119 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf zcip.script
120 do
121 cp $stuff/$f $fs/etc
122 done
123 chown -R 0.0 $fs/etc
124 chmod 600 $fs/etc/busybox.conf
125 touch $fs/etc/resolv.conf
127 # Daemon scripts.
128 cp $stuff/daemon $fs/etc/init.d
129 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
130 for i in $DAEMON; do
131 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
132 ln -s daemon $fs/etc/init.d/$i
133 done
134 rm $fs/linuxrc
135 mkdir -p $fs/etc/modprobe.d
137 # Udhcpc stuff.
138 mkdir -p $fs/usr/share/udhcpc
139 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
140 chmod +x $fs/usr/share/udhcpc/default.script
142 # Httpd stuff.
143 cp -a $stuff/www $fs/var
144 }
146 # GNU utils stuff.
147 pre_install()
148 {
149 local i
150 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
151 answer=""
152 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
153 [ -f $1$i ] || continue
154 case "$i" in
155 /bin/busybox) continue ;;
156 *bin/*) ;;
157 *) continue ;;
158 esac
159 if [ -z "$answer" ]; then
160 echo -n "Keep installed GNU utilities ? "
161 read -t 30 answer # by default: keep
162 case "$answer" in
163 n*|N*) break;;
164 *) answer="Y";;
165 esac
166 fi
167 cp -a $1$i $1$i-busybox-install
168 done
169 }
171 post_install()
172 {
173 local i
174 [ -f /etc/resolv.conf-busybox-install ] &&
175 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
176 while read i ; do
177 [ -f $1$i-busybox-install ] || continue
178 mv $1$i-busybox-install $1$i
179 done < $1$INSTALLED/$PACKAGE/files.list
180 chmod 4755 $1/bin/busybox
182 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
183 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
184 echo '# Domain name server options.' >> $root/etc/daemons.conf
185 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
186 echo '' >> $root/etc/daemons.conf
187 fi
188 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
189 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
190 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
191 echo '' >> $root/etc/daemons.conf
192 fi
193 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
194 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
195 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
196 echo '' >> $root/etc/daemons.conf
197 fi
198 }
200 pre_remove()
201 {
202 # We can not remove this package !
203 exit 1
204 }