wok-tiny view busybox-net/receipt @ rev 173

Fix ctorrent-dnh & tfttest
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 14 09:04:04 2021 +0000 (2021-07-14)
parents c21687abfa6a
children 00ad93bee405
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox-net"
4 VERSION="1.28-20170822"
5 GIT_TAG="753c4045e4f287fc4b4788afd94f58738a7f04b4"
6 CATEGORY="base-system"
7 SHORT_DESC="Busybox UNIX utilities with many network commands."
8 MAINTAINER="pascal.bellard@slitaz.org"
9 LICENSE="GPL2"
10 [ -n "$TARGET" ] || TARGET="i486"
11 DEPENDS="busybox"
12 BUILD_DEPENDS="bzip2 uclibc-cross-compiler-$TARGET wget"
13 TARBALL="busybox-$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 /etc/network.conf /etc/inetd.conf"
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/busybox-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 _install/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 _install/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" _install/lib
68 done
69 done
70 chown 0.0 _install/lib/*
71 }
73 # Rules to gen a SliTaz package suitable for Tazpkg.
74 genpkg_rules()
75 {
76 mkdir -p $fs/boot $fs/bin $fs/sbin $fs/etc/init.d
77 sed -e 's| *#.*$||' -e '/^$/d' < $stuff/services > $fs/etc/services
78 cp -a $src/_install/bin/busybox $fs/bin
79 for i in /bin/sh /bin/login /bin/false /sbin/mdev /init ; do
80 ln -f $fs/bin/busybox $fs$i
81 done
83 # Busybox config files.
84 touch $fs/etc/resolv.conf
85 cp $stuff/inetd.conf $fs/etc
86 cp $stuff/network.conf $fs/etc
87 cp $stuff/daemon $fs/etc/init.d
88 cp $stuff/network.sh $fs/etc/init.d
89 for i in crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd \
90 udhcpd zcip ; do
91 grep -qi config_$i=y $src/.config &&
92 ln -s daemon $fs/etc/init.d/$i
93 done
94 # Udhcpc stuff.
95 mkdir -p $fs/usr/share/udhcpc
96 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
97 chmod +x $fs/usr/share/udhcpc/default.script
99 sed -i '2,$s/^#.*//;/^$/d' $fs/etc/init.d/daemon $fs/etc/init.d/*.sh
100 sed -i 's/^#.*//;/^$/d' $fs/etc/*.conf
101 find $fs -exec touch -r $fs {} \;
102 cp $stuff/busybox-net-git.config $fs/boot/config-busybox
103 }
105 config_form()
106 {
107 if [ -z "$MODE" ]; then
108 [ -n "$INTERFACE" ] || INTERFACE=eth0
109 [ -n "$IP" ] || IP=192.168.0.6
110 [ -n "$NETMASK" ] || NETMASK=255.255.255.0
111 [ -n "$GATEWAY" ] || GATEWAY=192.168.0.1
112 [ -n "$DNS_SERVER" ] || DNS_SERVER='192.168.0.1 192.168.0.2'
113 fi
114 cat <<EOT
115 <table>
116 <tr>
117 <td>Interface</td>
118 <td><input type="text" name="INTERFACE" value="$INTERFACE" /></td>
119 </tr>
120 <tr>
121 <td>Network configuration</td>
122 <td><select name="MODE">
123 <option value="STATIC">STATIC</option>
124 <option value="DHCP"$([ "$MODE" = "DHCP" ] && echo ' selected="selected"')>DHCP</option>
125 <option value="DISABLE"$([ "$MODE" = "DISABLE" ] && echo ' selected="selected"')>DISABLE</option>
126 </select></td>
127 </tr>
128 <tr>
129 <td>Internet address</td>
130 <td><input type="text" name="IP" value="$IP" /></td>
131 </tr>
132 <tr>
133 <td>Netmask</td>
134 <td><input type="text" name="NETMASK" value="$NETMASK" /></td>
135 </tr>
136 <tr>
137 <td>Gateway</td>
138 <td><input type="text" name="GATEWAY" value="$GATEWAY" /></td>
139 </tr>
140 <tr>
141 <td>DNS server(s)</td>
142 <td><input type="text" name="DNS_SERVER" value="$DNS_SERVER" /></td>
143 </tr>
144 </table>
145 EOT
146 }
148 config_note()
149 {
150 cat <<EOT
151 <script type="text/javascript">
152 function update_form()
153 {
154 var hide = true
155 for (var i = 0; i < document.forms.length; i++) {
156 for (var j = 0; j < document.forms[i].elements.length; j++) {
157 var obj = document.forms[i].elements[j]
158 if (obj.name == "MODE" && obj.value == "STATIC")
159 hide = false
160 }
161 }
162 for (var i = 0; i < document.forms.length; i++) {
163 for (var j = 0; j < document.forms[i].elements.length; j++) {
164 var obj = document.forms[i].elements[j]
165 switch (obj.name) {
166 case "IP" :
167 case "NETMASK" :
168 case "GATEWAY" :
169 case "DNS_SERVER" :
170 obj.disabled = hide; break;
171 }
172 }
173 }
174 }
175 update_form()
176 window.onchange = update_form
177 //-->
178 </script>
179 EOT
180 }
182 post_install()
183 {
184 sed -i 's|local.sh|network.sh &|' $1/etc/rcS.conf
185 chmod 4755 $1/bin/busybox
186 ln -fs /proc/mounts $1/etc/mtab
187 DHCP="no"
188 STATIC="yes"
189 case "$MODE" in
190 "") return 1;;
191 DISABLE)
192 STATIC="no" ;;
193 DHCP) DHCP="yes"
194 STATIC="no"
195 esac
196 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \
197 -e "s/^INTERFACE=.*/INTERFACE=\"$INTERFACE\"/" \
198 -e "s/^NETMASK=.*/NETMASK=\"$NETMASK\"/" \
199 -e "s/^GATEWAY=.*/GATEWAY=\"$GATEWAY\"/" \
200 -e "s/^STATIC=.*/STATIC=\"$STATIC\"/" \
201 -e "s/^DHCP=.*/DHCP=\"$DHCP\"/" \
202 -e "s/^IP=.*/IP=\"$IP\"/" $1/etc/network.conf
203 [ -n "$HOSTNAME" ] && echo $HOSTNAME > $1/etc/hostname
204 }