wok-tiny view busybox/receipt @ rev 128

busybox/mdev: restore /sys layout
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Apr 13 19:09:32 2017 +0200 (2017-04-13)
parents b422abc85a5f
children 8aceeb13c59a
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.26.2"
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 cmdline.u
32 diff.u
33 diet.u
34 losetup.u
35 fbvnc.u
36 cpio.u
37 ftpd.u
38 shutdown.u
39 scriptreplay.u
40 bug9471.u
41 EOT
42 [ $(. $WOK/linux/receipt; printf "%d%02d%02d" ${VERSION//./ }) -le 20626 ] &&
43 patch -p1 -R < $stuff/0001-mdev-create-devices-from-sys-dev.patch
44 cp $stuff/$PACKAGE-${VERSION%.*}.config .config
45 var="CONFIG_CROSS_COMPILER_PREFIX"
46 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config
47 }
49 # Rules to configure and make the package.
50 compile_rules()
51 {
52 { apply_bb_patchs &&
53 make oldconfig &&
54 make &&
55 make install
56 } || return 1
57 echo "Chmod 4755 on busybox binary..."
58 chmod 4755 _install/bin/busybox
59 mkdir -p rootfs/lib
60 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \
61 uclibc-$TARGET-ldd busybox 2> /dev/null | \
62 awk '/=>/ { print $3 }' | while read file ; do
63 cp -a $file rootfs/lib
64 while [ -L "$file" ]; do
65 dir="$(dirname $file)/"
66 file="$(readlink $file)"
67 case "$file" in
68 /*) ;;
69 *) file="$dir$file";;
70 esac
71 cp -a "$file" rootfs/lib
72 done
73 done
74 chown 0.0 rootfs/lib/*
75 }
77 # Rules to gen a SliTaz package suitable for Tazpkg.
78 genpkg_rules()
79 {
80 cp -a $WOK/base-tiny/stuff/. $fs/
81 cp -a $src/_install/bin/busybox $fs/bin
82 for i in /bin/sh /bin/login /bin/false ; do
83 ln $fs/bin/busybox $fs$i
84 done
85 mkdir -p $fs/etc/init.d
86 # Busybox config files.
87 cp $stuff/busybox.conf $fs/etc
88 chmod 600 $fs/etc/busybox.conf
89 #cp $stuff/dnsd.conf $fs/etc
90 #cp $stuff/udhcpd.conf $fs/etc
91 touch $fs/etc/resolv.conf
92 cp $stuff/inetd.conf $fs/etc
93 cp $stuff/daemon $fs/etc/init.d
94 for i in crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd \
95 udhcpd zcip ; do
96 grep -qi config_$i=y $src/.config &&
97 ln -s daemon $fs/etc/init.d/$i
98 done
99 #rm $fs/linuxrc
100 #mkdir -p $fs/etc/modprobe.d
101 # Udhcpc stuff.
102 mkdir -p $fs/usr/share/udhcpc
103 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
104 chmod +x $fs/usr/share/udhcpc/default.script
105 # ZeroConf stuff.
106 #cp $stuff/zcip.script $fs/etc
107 # Httpd stuff.
108 #cp $stuff/httpd_helper.sh $fs/usr/bin
109 #chmod +x $fs/usr/bin/httpd_helper.sh
110 # .desktop stuff
111 mkdir -p $fs/usr/share
112 #cp -a $stuff/applications $fs/usr/share
113 # prepare rootfs.cpio for kernel-* packages
114 mkdir -p $src/rootfs/lib
115 cp -a $fs/. $src/rootfs/.
116 cd $src
117 false &&
118 for i in slitaz-base-files slitaz-boot-scripts ; do
119 tazpkg get $i
120 tazpkg extract $i*.tazpkg
121 cp -a $i*/fs/. rootfs/.
122 grep -qs ^post_install $i*/receipt || continue
123 ( . $i*/receipt ; post_install rootfs )
124 done
126 ln rootfs/bin/busybox rootfs/init
127 #ln -s var/tmp rootfs/tmp
129 sed -i 's/[ \t]*#.*//;s/[ \t] / /g;s/[ \t]\t/\t/g;/^$/d' rootfs/etc/services
130 sed -i '2,$s/^#.*//;/^$/d' rootfs/etc/init.d/rc* rootfs/etc/init.d/daemon \
131 rootfs/etc/init.d/*.sh
132 sed -i 's/^#.*//;/^$/d' rootfs/etc/*.conf rootfs/etc/*tab \
133 rootfs/etc/profile rootfs/etc/securetty rootfs/etc/shells
134 find rootfs -exec touch -r rootfs {} \;
135 ( cd rootfs ; find | cpio -o -H newc ) > rootfs.cpio
136 du -h rootfs.cpio
138 rm -rf $fs/*
139 cp rootfs.cpio $fs
140 cp $stuff/busybox-${VERSION%.*}*config $fs/busybox.config.txt
141 }
143 # Force glibc-2.7 reinstall if 2.3.6 still in use.
144 pre_install()
145 {
146 local i
147 cp -a /etc/resolv.conf /etc/resolv.conf-busybox-install
148 answer=""
149 for i in $(cat $1$INSTALLED/$PACKAGE/files.list); do
150 [ -f $1$i ] || continue
151 case "$i" in
152 /bin/busybox) continue ;;
153 *bin/*) ;;
154 *) continue ;;
155 esac
156 if [ -z "$answer" ]; then
157 echo -n "Keep installed GNU utilities ? "
158 read -t 30 answer # by default: keep
159 case "$answer" in
160 n*|N*) break;;
161 *) answer="Y";;
162 esac
163 fi
164 cp -a $1$i $1$i-busybox-install
165 done
166 }
168 post_install()
169 {
170 local i
171 [ -f /etc/resolv.conf-busybox-install ] &&
172 mv -f /etc/resolv.conf-busybox-install /etc/resolv.conf
173 while read i ; do
174 [ -f $1$i-busybox-install ] || continue
175 mv $1$i-busybox-install $1$i
176 done < $1$INSTALLED/$PACKAGE/files.list
177 chmod 4755 $1/bin/busybox
178 sed -i "s@vcsa2txt.*\$@busybox conspy -d | sed 's/ *\$//;/^\$/d;/^Processi\\\\|^.witchi/,\$!d' > /var/log/boot.log@" $1/etc/init.d/rcS
179 }