wok view busybox/receipt @ rev 13479

grooms: chown to www
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 10 15:15:42 2012 +0200 (2012-10-10)
parents 1ca52b3246f2
children bd8f09202680
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.20.2"
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"
16 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf \
17 /etc/resolv.conf /etc/httpd.conf"
18 AUFS_NOT_SUPPORTED="uclibc-cross-compiler-i486 is not compatible with aufs 8("
20 # Handle cross compilation
21 case "$ARCH" in
22 arm) BUILD_DEPENDS="bzip2" ;;
23 esac
25 # Busybox patches
26 apply_bb_patchs()
27 {
28 cd $src
29 while read file; do
30 [ -f done.$file ] && continue
31 echo "Apply $file..."
32 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
33 touch done.$file
34 done <<EOT
35 tar.u
36 stat.u
37 ris.u
38 zmodules.u
39 printable.u
40 cmdline.u
41 su-nochdir.u
42 diff.u
43 blkid-swap.u
44 EOT
45 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
46 }
48 # Rules to configure and make the package.
49 compile_rules()
50 {
51 case "$ARCH" in
52 arm)
53 echo "cook: CROSS_COMPILE=$CROSS_COMPILE"
54 apply_bb_patchs &&
55 cp $stuff/arm/$PACKAGE.config .config
56 make oldconfig &&
57 make && make install || return 1
58 chmod 4755 $src/_install/bin/busybox ;;
59 x86_64) echo "TODO" ;;
60 i?86)
61 apply_bb_patchs &&
62 make oldconfig &&
63 make && make install || return 1
64 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr \
65 $src/_install/bin/busybox
67 # prepare busybox-pam package
68 sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
69 make oldconfig && make || return 1
70 strip --strip-unneeded -R .eh_frame -R .eh_frame_hdr busybox
71 mv busybox busybox-pam
73 # prepare busybox-static package
74 cp $stuff/$PACKAGE-${VERSION%.*}.config-static .config
75 make oldconfig && make || return 1
76 mv busybox busybox-static
78 # prepare ssfs-busybox package
79 rootfs=$src/ssfs-busybox/usr/share/ssfs/rootfs
80 mkdir -p $rootfs/etc
81 cp $stuff/$PACKAGE-${VERSION%.*}.config-ssfs .config
82 make oldconfig && make busybox &&
83 make CONFIG_PREFIX=$rootfs install || return 1
84 cp $stuff/busybox.conf-ssfs $rootfs/etc/busybox.conf
85 chown -R 0.0 $rootfs/etc
86 chmod 0600 $rootfs/etc/busybox.conf
87 chmod 4755 $rootfs/bin/busybox ;;
88 esac
89 }
91 # Cross compilation check.
92 testsuite()
93 {
94 readelf -h $src/_install/bin/busybox
95 }
97 # Rules to gen a SliTaz package suitable for Tazpkg.
98 genpkg_rules()
99 {
100 cp -a $src/_install/* $fs
101 rm -f $fs/bin/bbconfig $fs/usr/bin/ar
102 mkdir -p $fs/etc/init.d $fs/var
104 # Busybox config files.
105 for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
106 syslog.conf zcip.script
107 do
108 cp $stuff/$f $fs/etc
109 done
110 chown -R 0.0 $fs/etc
111 chmod 600 $fs/etc/busybox.conf
112 touch $fs/etc/resolv.conf
114 # Daemon scripts.
115 cp $stuff/daemon $fs/etc/init.d
116 DAEMON="crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd udhcpd zcip"
117 for i in $DAEMON; do
118 grep -qi config_$i=y $stuff/$PACKAGE-${VERSION%.*}.config &&
119 ln -s daemon $fs/etc/init.d/$i
120 done
121 rm $fs/linuxrc
122 mkdir -p $fs/etc/modprobe.d
124 # Udhcpc stuff.
125 mkdir -p $fs/usr/share/udhcpc
126 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
127 chmod +x $fs/usr/share/udhcpc/default.script
129 # Httpd stuff.
130 cp $stuff/httpd_helper.sh $fs/usr/bin
131 chmod +x $fs/usr/bin/httpd_helper.sh
132 cp -a $stuff/www $fs/var
133 }
135 # GNU utils stuff.
136 pre_install()
137 {
138 local i
139 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
140 answer=""
141 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
142 [ -f $1$i ] || continue
143 case "$i" in
144 /bin/busybox) continue ;;
145 *bin/*) ;;
146 *) continue ;;
147 esac
148 if [ -z "$answer" ]; then
149 echo -n "Keep installed GNU utilities ? "
150 read -t 30 answer # by default: keep
151 case "$answer" in
152 n*|N*) break;;
153 *) answer="Y";;
154 esac
155 fi
156 cp -a $1$i $1$i-busybox-install
157 done
158 }
160 post_install()
161 {
162 local i
163 [ -f /etc/resolv.conf-busybox-install ] &&
164 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
165 while read i ; do
166 [ -f $1$i-busybox-install ] || continue
167 mv $1$i-busybox-install $1$i
168 done < $1$INSTALLED/$PACKAGE/files.list
169 chmod 4755 $1/bin/busybox
171 # /etc/daemons.conf (tftp + dnsd + httpd may not be present)
172 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
173 echo '# Domain name server options.' >> $root/etc/daemons.conf
174 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
175 echo '' >> $root/etc/daemons.conf
176 fi
177 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
178 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
179 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
180 echo '' >> $root/etc/daemons.conf
181 fi
182 if ! grep -q ^HTTPD_OPTIONS $root/etc/daemons.conf; then
183 echo '# Busybox HTTP web server options.' >> $root/etc/daemons.conf
184 echo 'HTTPD_OPTIONS="-u www"' >> $root/etc/daemons.conf
185 echo '' >> $root/etc/daemons.conf
186 fi
187 }
189 pre_remove()
190 {
191 # We can not remove this package !
192 exit 1
193 }