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

Add geninitramfs & busybox-net
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 28 16:03:43 2020 +0100 (2020-02-28)
parents
children 45eaacc1faf8
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 advancecomp"
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 [ "$(which advdef)" ] &&
41 sed -i 's|^cmd_gzip.*|& \&\& advdef -z4 $@|' scripts/Makefile.lib
42 cp $stuff/$PACKAGE-git.config .config
43 var="CONFIG_CROSS_COMPILER_PREFIX"
44 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config
45 }
47 # Rules to configure and make the package.
48 compile_rules()
49 {
50 { apply_bb_patchs &&
51 make oldconfig &&
52 make &&
53 make install
54 } || return 1
55 echo "Chmod 4755 on busybox binary..."
56 chmod 4755 _install/bin/busybox
57 mkdir -p _install/lib
58 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \
59 uclibc-$TARGET-ldd busybox 2> /dev/null | \
60 awk '/=>/ { print $3 }' | while read file ; do
61 cp -a $file _install/lib
62 while [ -L "$file" ]; do
63 dir="$(dirname $file)/"
64 file="$(readlink $file)"
65 case "$file" in
66 /*) ;;
67 *) file="$dir$file";;
68 esac
69 cp -a "$file" _install/lib
70 done
71 done
72 chown 0.0 _install/lib/*
73 }
75 # Rules to gen a SliTaz package suitable for Tazpkg.
76 genpkg_rules()
77 {
78 mkdir $fs/bin $fs/boot
79 cp -a $src/_install/bin/busybox $fs/bin
80 for i in /bin/sh /bin/login /bin/false /init ; do
81 ln -f $fs/bin/busybox $fs$i
82 done
83 mkdir -p $fs/etc/init.d
84 for i in etc/init.d/network.sh etc/network.conf etc/services etc/networks \
85 etc/inetd.conf etc/host.conf etc/hosts ; do
86 cp -a $WOK/base-tiny/stuff/$i $fs/$i
87 done
88 sed '/hostname/{Nd}' -i etc/init.d/network.sh
90 # Busybox config files.
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 # Udhcpc stuff.
100 mkdir -p $fs/usr/share/udhcpc
101 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script
102 chmod +x $fs/usr/share/udhcpc/default.script
104 sed -i '2,$s/^#.*//;/^$/d' $fs/etc/init.d/rc* $fs/etc/init.d/daemon \
105 $fs/etc/init.d/*.sh
106 sed -i 's/^#.*//;/^$/d' $fs/etc/*.conf $fs/etc/*tab \
107 $fs/etc/profile $fs/etc/securetty $fs/etc/shells
109 cp $stuff/busybox-net-git.config $fs/boot/config-busybox
110 }
112 config_form()
113 {
114 if [ -z "$MODE" ]; then
115 [ -n "$HOSTNAME" ] || HOSTNAME=slitaz
116 [ -n "$INTERFACE" ] || INTERFACE=eth0
117 [ -n "$IP" ] || IP=192.168.0.6
118 [ -n "$NETMASK" ] || NETMASK=255.255.255.0
119 [ -n "$GATEWAY" ] || GATEWAY=192.168.0.1
120 [ -n "$DNS_SERVER" ] || DNS_SERVER='192.168.0.1 192.168.0.2'
121 fi
122 cat <<EOT
123 <table>
124 <tr>
125 <td>Host name</td>
126 <td><input type="text" name="HOSTNAME" value="$HOSTNAME" /></td>
127 </tr>
128 <tr>
129 <td>Interface</td>
130 <td><input type="text" name="INTERFACE" value="$INTERFACE" /></td>
131 </tr>
132 <tr>
133 <td>Network configuration</td>
134 <td><select name="MODE">
135 <option value="STATIC">STATIC</option>
136 <option value="DHCP"$([ "$MODE" = "DHCP" ] && echo ' selected="selected"')>DHCP</option>
137 <option value="DISABLE"$([ "$MODE" = "DISABLE" ] && echo ' selected="selected"')>DISABLE</option>
138 </select></td>
139 </tr>
140 <tr>
141 <td>Internet address</td>
142 <td><input type="text" name="IP" value="$IP" /></td>
143 </tr>
144 <tr>
145 <td>Netmask</td>
146 <td><input type="text" name="NETMASK" value="$NETMASK" /></td>
147 </tr>
148 <tr>
149 <td>Gateway</td>
150 <td><input type="text" name="GATEWAY" value="$GATEWAY" /></td>
151 </tr>
152 <tr>
153 <td>DNS server(s)</td>
154 <td><input type="text" name="DNS_SERVER" value="$DNS_SERVER" /></td>
155 </tr>
156 </table>
157 EOT
158 }
160 post_install()
161 {
162 sed -i 's|local.sh|network.sh &|' $1/etc/rcS.conf
163 chmod 4755 $1/bin/busybox
164 DHCP="no"
165 STATIC="yes"
166 case "$MODE" in
167 "") return 1;;
168 DISABLE)
169 STATIC="no" ;;
170 DHCP) DHCP="yes"
171 STATIC="no"
172 esac
173 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \
174 -e "s/^INTERFACE=.*/INTERFACE=\"$INTERFACE\"/" \
175 -e "s/^NETMASK=.*/NETMASK=\"$NETMASK\"/" \
176 -e "s/^GATEWAY=.*/GATEWAY=\"$GATEWAY\"/" \
177 -e "s/^STATIC=.*/STATIC=\"$STATIC\"/" \
178 -e "s/^DHCP=.*/DHCP=\"$DHCP\"/" \
179 -e "s/^IP=.*/IP=\"$IP\"/" $1/etc/network.conf
180 [ -n "$HOSTNAME" ] && echo $HOSTNAME > $1/etc/hostname
181 }