wok view busybox/receipt @ rev 12089

busybox: tftpd should chroot (thanks Don Manuel)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 10 12:59:12 2012 +0100 (2012-03-10)
parents a5fbfa5737a6
children fa31026b97ce
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 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-i486 is not compatible with aufs 8("
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 /etc/httpd.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 conspy.u
32 httpd.u
33 su-nochdir.u
34 tftp-chroot.u
35 EOT
36 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
37 }
39 # Rules to compile & install the temporary toolchain.
40 cook_tmp_toolchain()
41 {
42 { stuff=${stuff:-../stuff}
43 apply_bb_patchs &&
44 make oldconfig &&
45 make &&
46 make CONFIG_PREFIX=/tools install
47 } || return 1
48 echo "Chmod 4755 on busybox binary..."
49 chmod 4755 /tools/bin/busybox
50 }
52 # Rules to configure and make the package.
53 compile_rules()
54 {
55 { apply_bb_patchs &&
56 make oldconfig &&
57 make &&
58 make install
59 } || return 1
61 # prepare busybox-pam package
62 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
63 make oldconfig && make || return 1
64 mv busybox busybox-pam
66 # prepare busybox-static package
67 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
68 make oldconfig && make || return 1
69 mv busybox busybox-static
71 # prepare ssfs-busybox package
72 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
73 mkdir -p $rootfs/etc
74 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
75 make oldconfig && make busybox &&
76 make CONFIG_PREFIX=$rootfs install || return 1
77 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
78 chown -R 0.0 $rootfs/etc
79 chmod 0600 $rootfs/etc/busybox.conf
80 chmod 4755 $rootfs/bin/busybox
81 }
83 # Rules to gen a SliTaz package suitable for Tazpkg.
84 genpkg_rules()
85 {
86 cp -a $src/_install/* $fs
87 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
88 mkdir -p $fs/etc/init.d $fs/var
90 # Busybox config files.
91 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf zcip.script
92 do
93 cp $stuff/$f $fs/etc
94 done
95 chown -R 0.0 $fs/etc
96 chmod 600 $fs/etc/busybox.conf
97 touch $fs/etc/resolv.conf
99 # Daemon scripts and init.
100 cp $stuff/daemon $fs/etc/init.d
101 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
102 for i in $DAEMON; do
103 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
104 ln -s daemon $fs/etc/init.d/$i
105 done
106 rm $fs/linuxrc
107 mkdir -p $fs/etc/modprobe.d
109 # Udhcpc stuff.
110 mkdir -p $fs/usr/share/udhcpc
111 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
112 chmod +x $fs/usr/share/udhcpc/default.script
114 # Httpd stuff.
115 cp $stuff/httpd_helper.sh $fs/usr/bin
116 chmod +x $fs/usr/bin/httpd_helper.sh
117 cp -a $stuff/www $fs/var
118 }
120 # Force glibc-2.7 reinstall if 2.3.6 still in use.
121 pre_install()
122 {
123 local i
124 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
125 if grep -q 'VERSION="2.3.6"' /var/lib/tazpkg/installed/glibc-base/receipt; then
126 tazpkg get-install glibc-base --forced
127 fi
128 answer=""
129 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
130 [ -f $1$i ] || continue
131 case "$i" in
132 /bin/busybox) continue ;;
133 *bin/*) ;;
134 *) continue ;;
135 esac
136 if [ -z "$answer" ]; then
137 echo -n "Keep installed GNU utilities ? "
138 read -t 30 answer # by default: keep
139 case "$answer" in
140 n*|N*) break;;
141 *) answer="Y";;
142 esac
143 fi
144 cp -a $1$i $1$i-busybox-install
145 done
146 }
148 post_install()
149 {
150 local i
151 [ -f /etc/resolv.conf-busybox-install ] &&
152 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
153 while read i ; do
154 [ -f $1$i-busybox-install ] || continue
155 mv $1$i-busybox-install $1$i
156 done < $1$INSTALLED/$PACKAGE/files.list
157 chmod 4755 $1/bin/busybox
159 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
160 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
161 echo '# Domain name server options.' >> $root/etc/daemons.conf
162 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
163 echo '' >> $root/etc/daemons.conf
164 fi
165 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
166 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
167 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
168 echo '' >> $root/etc/daemons.conf
169 fi
170 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
171 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
172 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
173 echo '' >> $root/etc/daemons.conf
174 fi
175 }
177 pre_remove()
178 {
179 # We can not remove this package !
180 exit 1
181 }