wok view busybox/receipt @ rev 11208

Add from wok-undigest: seed
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Nov 03 11:20:57 2011 +0100 (2011-11-03)
parents 46c3a889a648
children a6b781a0cffb
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.18.4"
5 CATEGORY="base-system"
6 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 DEPENDS="slitaz-base-files glibc-base ncurses-common"
9 BUILD_DEPENDS="bzip2 pam pam-dev uclibc-cross-compiler-i486"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.busybox.net/"
12 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
13 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf /etc/resolv.conf /etc/httpd.conf"
15 apply_bb_patchs()
16 {
17 cd $src
18 while read file; do
19 [ -f done.$file ] && continue
20 echo "Apply $file..."
21 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
22 touch done.$file
23 done <<EOT
24 tar.u
25 stat.u
26 ris.u
27 zmodules.u
28 printable.u
29 cmdline.u
30 conspy.u
31 EOT
32 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
33 }
35 # Rules to compile & install the temporary toolchain.
36 cook_tmp_toolchain()
37 {
38 { stuff=${stuff:-../stuff}
39 apply_bb_patchs &&
40 make oldconfig &&
41 make &&
42 make CONFIG_PREFIX=/tools install
43 } || return 1
44 echo "Chmod 4755 on busybox binary..."
45 chmod 4755 /tools/bin/busybox
46 }
48 # Rules to configure and make the package.
49 compile_rules()
50 {
51 { apply_bb_patchs &&
52 make oldconfig &&
53 make &&
54 make install
55 } || return 1
57 # prepare busybox-pam package
58 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
59 make oldconfig && make || return 1
60 mv busybox busybox-pam
62 # prepare busybox-static package
63 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
64 make oldconfig && make || return 1
65 mv busybox busybox-static
67 # prepare ssfs-busybox package
68 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
69 mkdir -p $rootfs/etc
70 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
71 make oldconfig && make busybox &&
72 make CONFIG_PREFIX=$rootfs install || return 1
73 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
74 chown -R 0.0 $rootfs/etc
75 chmod 0600 $rootfs/etc/busybox.conf
76 chmod 4755 $rootfs/bin/busybox
77 }
79 # Rules to gen a SliTaz package suitable for Tazpkg.
80 genpkg_rules()
81 {
82 cp -a $src/_install/* $fs
83 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
84 mkdir -p $fs/etc/init.d $fs/var
86 # Busybox config files.
87 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf zcip.script
88 do
89 cp $stuff/$f $fs/etc
90 done
91 chown -R 0.0 $fs/etc
92 chmod 600 $fs/etc/busybox.conf
93 touch $fs/etc/resolv.conf
95 # Daemon scripts and init.
96 cp $stuff/daemon $fs/etc/init.d
97 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
98 for i in $DAEMON; do
99 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
100 ln -s daemon $fs/etc/init.d/$i
101 done
102 cp $stuff/init $fs
103 rm $fs/linuxrc
104 mkdir -p $fs/etc/modprobe.d
106 # Udhcpc stuff.
107 mkdir -p $fs/usr/share/udhcpc
108 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
109 chmod +x $fs/usr/share/udhcpc/default.script
111 # Httpd stuff.
112 cp $stuff/httpd_helper.sh $fs/usr/bin
113 chmod +x $fs/usr/bin/httpd_helper.sh
114 cp -a $stuff/www $fs/var
115 }
117 # Force glibc-2.7 reinstall if 2.3.6 still in use.
118 pre_install()
119 {
120 local i
121 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
122 if grep -q 'VERSION="2.3.6"' /var/lib/tazpkg/installed/glibc-base/receipt; then
123 tazpkg get-install glibc-base --forced
124 fi
125 answer=""
126 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
127 [ -f $1$i ] || continue
128 case "$i" in
129 /bin/busybox) continue ;;
130 *bin/*) ;;
131 *) continue ;;
132 esac
133 if [ -z "$answer" ]; then
134 echo -n "Keep installed GNU utilities ? "
135 read -t 30 answer # by default: keep
136 case "$answer" in
137 n*|N*) break;;
138 *) answer="Y";;
139 esac
140 fi
141 cp -a $1$i $1$i-busybox-install
142 done
143 }
145 post_install()
146 {
147 local i
148 [ -f /etc/resolv.conf-busybox-install ] &&
149 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
150 while read i ; do
151 [ -f $1$i-busybox-install ] || continue
152 mv $1$i-busybox-install $1$i
153 done < $1$INSTALLED/$PACKAGE/files.list
154 chmod 4755 $1/bin/busybox
156 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
157 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
158 echo '# Domain name server options.' >> $root/etc/daemons.conf
159 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
160 echo '' >> $root/etc/daemons.conf
161 fi
162 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
163 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
164 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
165 echo '' >> $root/etc/daemons.conf
166 fi
167 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
168 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
169 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
170 echo '' >> $root/etc/daemons.conf
171 fi
172 }
174 pre_remove()
175 {
176 # We can not remove this package !
177 exit 1
178 }