wok-tiny view busybox/receipt @ rev 122

busybox: shrink /etc/services
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 26 14:18:29 2016 +0100 (2016-12-26)
parents 7cd5e798bfe2
children f04e6a2d1224
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 LICENSE="GPL2"
9 [ -n "$TARGET" ] || TARGET="i486"
10 DEPENDS="slitaz-base-files"
11 BUILD_DEPENDS="bzip2 uclibc-cross-compiler-$TARGET"
12 TARBALL="$PACKAGE-$VERSION.tar.bz2"
13 WEB_SITE="http://www.busybox.net/"
14 WGET_URL="http://www.busybox.net/downloads/$TARBALL"
15 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf /etc/resolv.conf"
16 AUTO_SELECTION="never"
18 apply_bb_patchs()
19 {
20 cd $src
21 while read file; do
22 [ -f done.$file ] && continue
23 echo "Apply $file..."
24 patch -p1 < $stuff/$PACKAGE-${VERSION%.*}-$file || return 1
25 touch done.$file
26 done <<EOT
27 tar.u
28 stat.u
29 ris.u
30 zmodules.u
31 printable.u
32 cmdline.u
33 conspy.u
34 EOT
35 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
36 var="CONFIG_CROSS_COMPILER_PREFIX"
37 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config
38 }
40 # Rules to configure and make the package.
41 compile_rules()
42 {
43 { apply_bb_patchs &&
44 make oldconfig &&
45 make &&
46 make install
47 } || return 1
48 echo "Chmod 4755 on busybox binary..."
49 chmod 4755 _install/bin/busybox
50 mkdir -p rootfs/lib
51 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \
52 uclibc-$TARGET-ldd busybox 2> /dev/null | \
53 awk '/=>/ { print $3 }' | while read file ; do
54 cp -a $file rootfs/lib
55 while [ -L "$file" ]; do
56 dir="$(dirname $file)/"
57 file="$(readlink $file)"
58 case "$file" in
59 /*) ;;
60 *) file="$dir$file";;
61 esac
62 cp -a "$file" rootfs/lib
63 done
64 done
65 chown 0.0 rootfs/lib/*
66 }
68 # Rules to gen a SliTaz package suitable for Tazpkg.
69 genpkg_rules()
70 {
71 cp -a $WOK/base-tiny/stuff/. $fs/
72 cp -a $src/_install/bin/busybox $fs/bin
73 for i in /bin/sh /bin/login /bin/false ; do
74 ln $fs/bin/busybox $fs$i
75 done
76 mkdir -p $fs/etc/init.d
77 # Busybox config files.
78 cp $stuff/busybox.conf $fs/etc
79 chmod 600 $fs/etc/busybox.conf
80 #cp $stuff/dnsd.conf $fs/etc
81 #cp $stuff/udhcpd.conf $fs/etc
82 touch $fs/etc/resolv.conf
83 cp $stuff/inetd.conf $fs/etc
84 cp $stuff/daemon $fs/etc/init.d
85 for i in crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd \
86 udhcpd zcip ; do
87 grep -qi config_$i=y $src/.config &&
88 ln -s daemon $fs/etc/init.d/$i
89 done
90 #rm $fs/linuxrc
91 #mkdir -p $fs/etc/modprobe.d
92 # Udhcpc stuff.
93 mkdir -p $fs/usr/share/udhcpc
94 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
95 chmod +x $fs/usr/share/udhcpc/default.script
96 # ZeroConf stuff.
97 #cp $stuff/zcip.script $fs/etc
98 # Httpd stuff.
99 #cp $stuff/httpd_helper.sh $fs/usr/bin
100 #chmod +x $fs/usr/bin/httpd_helper.sh
101 # .desktop stuff
102 mkdir -p $fs/usr/share
103 #cp -a $stuff/applications $fs/usr/share
104 # prepare rootfs.cpio for kernel-* packages
105 mkdir -p $src/rootfs/lib
106 cp -a $fs/. $src/rootfs/.
107 cd $src
108 false &&
109 for i in slitaz-base-files slitaz-boot-scripts ; do
110 tazpkg get $i
111 tazpkg extract $i*.tazpkg
112 cp -a $i*/fs/. rootfs/.
113 grep -qs ^post_install $i*/receipt || continue
114 ( . $i*/receipt ; post_install rootfs )
115 done
117 ln rootfs/bin/busybox rootfs/init
118 #ln -s var/tmp rootfs/tmp
120 sed -i 's/[ \t]*#.*//;s/[ \t] / /g;s/[ \t]\t/\t/g;/^$/d' rootfs/etc/services
121 ( cd rootfs ; find | cpio -o -H newc ) > rootfs.cpio
122 du -h rootfs.cpio
124 rm -rf $fs/*
125 cp rootfs.cpio $fs
126 cp $stuff/busybox-${VERSION%.*}*config $fs/busybox.config.txt
127 }
129 # Force glibc-2.7 reinstall if 2.3.6 still in use.
130 pre_install()
131 {
132 local i
133 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
134 answer=""
135 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
136 [ -f $1$i ] || continue
137 case "$i" in
138 /bin/busybox) continue ;;
139 *bin/*) ;;
140 *) continue ;;
141 esac
142 if [ -z "$answer" ]; then
143 echo -n "Keep installed GNU utilities ? "
144 read -t 30 answer # by default: keep
145 case "$answer" in
146 n*|N*) break;;
147 *) answer="Y";;
148 esac
149 fi
150 cp -a $1$i $1$i-busybox-install
151 done
152 }
154 post_install()
155 {
156 local i
157 [ -f /etc/resolv.conf-busybox-install ] &&
158 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
159 while read i ; do
160 [ -f $1$i-busybox-install ] || continue
161 mv $1$i-busybox-install $1$i
162 done < $1$INSTALLED/$PACKAGE/files.list
163 chmod 4755 $1/bin/busybox
164 sed -i "s@vcsa2txt.*\$@busybox conspy -d | sed 's/ *\$//;/^\$/d;/^Processi\\\\|^.witchi/,\$!d' > /var/log/boot.log@" $1/etc/init.d/rcS
165 }