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