wok-tiny view busybox/receipt @ rev 132

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