wok-tiny view busybox/receipt @ rev 0

Add busybox
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 01 09:36:49 2011 +0100 (2011-02-01)
parents
children e8ff6078f000
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.18.2"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 [ -n "$TARGET" ] || TARGET="i486"
9 DEPENDS="slitaz-base-files"
10 BUILD_DEPENDS="bzip2 uclibc-cross-compiler-$TARGET"
11 TARBALL="$PACKAGE-$VERSION.tar.bz2"
12 WEB_SITE="http://www.busybox.net/"
13 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
14 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf /etc/resolv.conf"
16 apply_bb_patchs()
17 {
18 cd $src
19 while read file; do
20 [ -f done.$file ] && continue
21 echo "Apply $file..."
22 patch -p1 < ../stuff/$PACKAGE-${VERSION%.*}-$file || return 1
23 touch done.$file
24 done <<EOT
25 tar.u
26 stat.u
27 ris.u
28 zmodules.u
29 printable.u
30 cmdline.u
31 EOT
32 cp ../stuff/$PACKAGE-${VERSION%.*}.config .config
33 var="CONFIG_CROSS_COMPILER_PREFIX"
34 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config
35 }
37 # Rules to compile & install the temporary toolchain.
38 cook_tmp_toolchain()
39 {
40 { apply_bb_patchs &&
41 make oldconfig &&
42 make &&
43 make CONFIG_PREFIX=/tools install
44 } || return 1
45 echo "Chmod 4755 on busybox binary..."
46 chmod 4755 /tools/bin/busybox
47 }
49 # Rules to configure and make the package.
50 compile_rules()
51 {
52 { apply_bb_patchs &&
53 make oldconfig &&
54 make &&
55 make install
56 } || return 1
57 echo "Chmod 4755 on busybox binary..."
58 chmod 4755 _install/bin/busybox
59 }
61 # Rules to gen a SliTaz package suitable for Tazpkg.
62 genpkg_rules()
63 {
64 cp -a $src/_install/* $fs
65 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
66 mkdir -p $fs/etc/init.d
67 # Busybox config files.
68 cp stuff/busybox.conf $fs/etc
69 chmod 600 $fs/etc/busybox.conf
70 cp stuff/dnsd.conf $fs/etc
71 cp stuff/udhcpd.conf $fs/etc
72 touch $fs/etc/resolv.conf
73 cp stuff/inetd.conf $fs/etc
74 cp stuff/daemon $fs/etc/init.d
75 for i in crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd \
76 udhcpd zcip ; do
77 grep -qi config_$i=y $src/.config &&
78 ln -s daemon $fs/etc/init.d/$i
79 done
80 cp stuff/init $fs
81 rm $fs/linuxrc
82 mkdir -p $fs/etc/modprobe.d
83 # Udhcpc stuff.
84 mkdir -p $fs/usr/share/udhcpc
85 cp stuff/udhcp.script $fs/usr/share/udhcpc/default.script
86 chmod +x $fs/usr/share/udhcpc/default.script
87 # ZeroConf stuff.
88 cp stuff/zcip.script $fs/etc
89 # Httpd stuff.
90 cp stuff/httpd_helper.sh $fs/usr/bin
91 chmod +x $fs/usr/bin/httpd_helper.sh
92 # .desktop stuff
93 mkdir -p $fs/usr/share
94 cp -a stuff/applications $fs/usr/share
95 # prepare rootfs.cpio for kernel-* packages
96 mkdir -p $src/rootfs/lib
97 cp -a $fs/. $src/rootfs/.
98 cd $src
99 for i in slitaz-base-files slitaz-boot-scripts ; do
100 tazpkg get $i
101 tazpkg extract $i*.tazpkg
102 cp -a $i*/fs/. rootfs/.
103 grep -qs ^post_install $i*/receipt || continue
104 ( . $i*/receipt ; post_install rootfs )
105 done
106 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \
107 uclibc-$TARGET-ldd busybox 2> /dev/null | \
108 awk '/=>/ { print $3 }' | while read file ; do
109 cp -a $file rootfs/lib
110 while [ -L "$file" ]; do
111 dir="$(dirname $file)/"
112 file="$(readlink $file)"
113 case "$file" in
114 /*) ;;
115 *) file="$dir$file";;
116 esac
117 cp -a "$file" rootfs/lib
118 done
119 done
120 chown 0.0 rootfs/lib/*
121 rm -rf rootfs/tmp rootfs/var/games rootfs/var/cache \
122 rootfs/bin/bootlog rootfs/etc/modprobe.d rootfs/home \
123 rootfs/sbin/mktazdevs.sh rootfs/usr/bin/man \
124 rootfs/usr/share/applications rootfs/sys \
125 rootfs/etc/nsswitch.conf rootfs/etc/zcip.script \
126 rootfs/etc/udhcpd.conf rootfs/etc/inetd.conf \
127 rootfs/usr/lib rootfs/usr/games rootfs/usr/share/doc \
128 rootfs/usr/local rootfs/var/lock rootfs/var/spool rootfs/media
130 ln -s var/tmp rootfs/tmp
132 ( cd rootfs ; find | cpio -o -H newc ) > rootfs.cpio
133 du -h rootfs.cpio
134 }
136 # Force glibc-2.7 reinstall if 2.3.6 still in use.
137 pre_install()
138 {
139 local i
140 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
141 answer=""
142 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
143 [ -f $1$i ] || continue
144 case "$i" in
145 /bin/busybox) continue ;;
146 *bin/*) ;;
147 *) continue ;;
148 esac
149 if [ -z "$answer" ]; then
150 echo -n "Keep installed GNU utilities ? "
151 read -t 30 answer # by default: keep
152 case "$answer" in
153 n*|N*) break;;
154 *) answer="Y";;
155 esac
156 fi
157 cp -a $1$i $1$i-busybox-install
158 done
159 }
161 post_install()
162 {
163 local i
164 [ -f /etc/resolv.conf-busybox-install ] &&
165 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
166 while read i ; do
167 [ -f $1$i-busybox-install ] || continue
168 mv $1$i-busybox-install $1$i
169 done < $1$INSTALLED/$PACKAGE/files.list
170 chmod 4755 $1/bin/busybox
171 sed -i "s@vcsa2txt.*\$@busybox conspy -d | sed 's/ *\$//;/^\$/d;/^Processi\\\\|^.witchi/,\$!d' > /var/log/boot.log@" $1/etc/init.d/rcS
172 }