wok-6.x view busybox/receipt @ rev 10818
busybox: add HTTPD_OPTIONS and start httpd as www user (+ add files forgot in previews commit)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Jun 06 00:44:11 2011 +0200 (2011-06-06) |
parents | 481d1e820d85 |
children | 46c3a889a648 |
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"
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
56 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
57 make oldconfig && make || return 1
58 mv busybox busybox-pam
59 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
60 make oldconfig && make || return 1
61 mv busybox busybox-static
62 }
64 # Rules to gen a SliTaz package suitable for Tazpkg.
65 genpkg_rules()
66 {
67 cp -a $src/_install/* $fs
68 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
69 mkdir -p $fs/etc/init.d $fs/var
71 # Busybox config files.
72 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf zcip.script
73 do
74 cp $stuff/$f $fs/etc
75 done
76 chown -R 0.0 $fs/etc
77 chmod 600 $fs/etc/busybox.conf
78 touch $fs/etc/resolv.conf
80 # Daemon scripts and init.
81 cp $stuff/daemon $fs/etc/init.d
82 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
83 for i in $DAEMON; do
84 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
85 ln -s daemon $fs/etc/init.d/$i
86 done
87 cp $stuff/init $fs
88 rm $fs/linuxrc
89 mkdir -p $fs/etc/modprobe.d
91 # Udhcpc stuff.
92 mkdir -p $fs/usr/share/udhcpc
93 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
94 chmod +x $fs/usr/share/udhcpc/default.script
96 # Httpd stuff.
97 cp $stuff/httpd_helper.sh $fs/usr/bin
98 chmod +x $fs/usr/bin/httpd_helper.sh
99 cp -a $stuff/www $fs/var
100 }
102 # Force glibc-2.7 reinstall if 2.3.6 still in use.
103 pre_install()
104 {
105 local i
106 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
107 if grep -q 'VERSION="2.3.6"' /var/lib/tazpkg/installed/glibc-base/receipt; then
108 tazpkg get-install glibc-base --forced
109 fi
110 answer=""
111 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
112 [ -f $1$i ] || continue
113 case "$i" in
114 /bin/busybox) continue ;;
115 *bin/*) ;;
116 *) continue ;;
117 esac
118 if [ -z "$answer" ]; then
119 echo -n "Keep installed GNU utilities ? "
120 read -t 30 answer # by default: keep
121 case "$answer" in
122 n*|N*) break;;
123 *) answer="Y";;
124 esac
125 fi
126 cp -a $1$i $1$i-busybox-install
127 done
128 }
130 post_install()
131 {
132 local i
133 [ -f /etc/resolv.conf-busybox-install ] &&
134 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
135 while read i ; do
136 [ -f $1$i-busybox-install ] || continue
137 mv $1$i-busybox-install $1$i
138 done < $1$INSTALLED/$PACKAGE/files.list
139 chmod 4755 $1/bin/busybox
141 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
142 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
143 echo '# Domain name server options.' >> $root/etc/daemons.conf
144 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
145 echo '' >> $root/etc/daemons.conf
146 fi
147 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
148 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
149 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
150 echo '' >> $root/etc/daemons.conf
151 fi
152 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
153 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
154 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
155 echo '' >> $root/etc/daemons.conf
156 fi
157 }
159 pre_remove()
160 {
161 # We can not remove this package !
162 exit 1
163 }