wok-tiny annotate 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 |
rev | line source |
---|---|
pascal@157 | 1 # SliTaz package receipt. |
pascal@157 | 2 |
pascal@157 | 3 PACKAGE="busybox-net" |
pascal@157 | 4 VERSION="1.28-20170822" |
pascal@157 | 5 GIT_TAG="753c4045e4f287fc4b4788afd94f58738a7f04b4" |
pascal@157 | 6 CATEGORY="base-system" |
pascal@157 | 7 SHORT_DESC="Busybox UNIX utilities with many network commands." |
pascal@157 | 8 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@157 | 9 LICENSE="GPL2" |
pascal@157 | 10 [ -n "$TARGET" ] || TARGET="i486" |
pascal@157 | 11 DEPENDS="busybox" |
pascal@157 | 12 BUILD_DEPENDS="bzip2 uclibc-cross-compiler-$TARGET wget advancecomp" |
pascal@157 | 13 TARBALL="busybox-$VERSION.tar.bz2" |
pascal@157 | 14 WEB_SITE="http://www.busybox.net/" |
pascal@157 | 15 WGET_URL="https://git.busybox.net/busybox/snapshot/busybox-$GIT_TAG.tar.bz2" |
pascal@157 | 16 CONFIG_FILES="/etc/dnsd.conf /etc/inetd.conf /etc/udhcpd.conf /etc/resolv.conf \ |
pascal@157 | 17 /etc/network.conf /etc/inetd.conf" |
pascal@157 | 18 |
pascal@157 | 19 apply_bb_patchs() |
pascal@157 | 20 { |
pascal@157 | 21 cd $src |
pascal@157 | 22 while read file; do |
pascal@157 | 23 [ -f done.$file ] && continue |
pascal@157 | 24 echo "Apply $file..." |
pascal@157 | 25 patch -p1 < $stuff/busybox-git-$file || return 1 |
pascal@157 | 26 touch done.$file |
pascal@157 | 27 done <<EOT |
pascal@157 | 28 stat.u |
pascal@157 | 29 ris.u |
pascal@157 | 30 zmodules.u |
pascal@157 | 31 cmdline.u |
pascal@157 | 32 fbvnc.u |
pascal@157 | 33 cpio.u |
pascal@157 | 34 scriptreplay.u |
pascal@157 | 35 ash.u |
pascal@157 | 36 EOT |
pascal@157 | 37 [ $(. $WOK/linux/receipt; printf "%d%02d%02d" ${VERSION//./ }) -le 20626 ] && |
pascal@157 | 38 echo apply 0001-mdev-create-devices-from-sys-dev.patch && |
pascal@157 | 39 patch -p1 -R < $stuff/0001-mdev-create-devices-from-sys-dev.patch |
pascal@157 | 40 [ "$(which advdef)" ] && |
pascal@157 | 41 sed -i 's|^cmd_gzip.*|& \&\& advdef -z4 $@|' scripts/Makefile.lib |
pascal@157 | 42 cp $stuff/$PACKAGE-git.config .config |
pascal@157 | 43 var="CONFIG_CROSS_COMPILER_PREFIX" |
pascal@157 | 44 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config |
pascal@157 | 45 } |
pascal@157 | 46 |
pascal@157 | 47 # Rules to configure and make the package. |
pascal@157 | 48 compile_rules() |
pascal@157 | 49 { |
pascal@157 | 50 { apply_bb_patchs && |
pascal@157 | 51 make oldconfig && |
pascal@157 | 52 make && |
pascal@157 | 53 make install |
pascal@157 | 54 } || return 1 |
pascal@157 | 55 echo "Chmod 4755 on busybox binary..." |
pascal@157 | 56 chmod 4755 _install/bin/busybox |
pascal@157 | 57 mkdir -p _install/lib |
pascal@157 | 58 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \ |
pascal@157 | 59 uclibc-$TARGET-ldd busybox 2> /dev/null | \ |
pascal@157 | 60 awk '/=>/ { print $3 }' | while read file ; do |
pascal@157 | 61 cp -a $file _install/lib |
pascal@157 | 62 while [ -L "$file" ]; do |
pascal@157 | 63 dir="$(dirname $file)/" |
pascal@157 | 64 file="$(readlink $file)" |
pascal@157 | 65 case "$file" in |
pascal@157 | 66 /*) ;; |
pascal@157 | 67 *) file="$dir$file";; |
pascal@157 | 68 esac |
pascal@157 | 69 cp -a "$file" _install/lib |
pascal@157 | 70 done |
pascal@157 | 71 done |
pascal@157 | 72 chown 0.0 _install/lib/* |
pascal@157 | 73 } |
pascal@157 | 74 |
pascal@157 | 75 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@157 | 76 genpkg_rules() |
pascal@157 | 77 { |
pascal@157 | 78 mkdir $fs/bin $fs/boot |
pascal@157 | 79 cp -a $src/_install/bin/busybox $fs/bin |
pascal@157 | 80 for i in /bin/sh /bin/login /bin/false /init ; do |
pascal@157 | 81 ln -f $fs/bin/busybox $fs$i |
pascal@157 | 82 done |
pascal@157 | 83 mkdir -p $fs/etc/init.d |
pascal@157 | 84 for i in etc/init.d/network.sh etc/network.conf etc/services etc/networks \ |
pascal@157 | 85 etc/inetd.conf etc/host.conf etc/hosts ; do |
pascal@157 | 86 cp -a $WOK/base-tiny/stuff/$i $fs/$i |
pascal@157 | 87 done |
pascal@157 | 88 sed '/hostname/{Nd}' -i etc/init.d/network.sh |
pascal@157 | 89 |
pascal@157 | 90 # Busybox config files. |
pascal@157 | 91 touch $fs/etc/resolv.conf |
pascal@157 | 92 cp $stuff/inetd.conf $fs/etc |
pascal@157 | 93 cp $stuff/daemon $fs/etc/init.d |
pascal@157 | 94 for i in crond dnsd ftpd httpd inetd klogd ntpd syslogd telnetd tftpd \ |
pascal@157 | 95 udhcpd zcip ; do |
pascal@157 | 96 grep -qi config_$i=y $src/.config && |
pascal@157 | 97 ln -s daemon $fs/etc/init.d/$i |
pascal@157 | 98 done |
pascal@157 | 99 # Udhcpc stuff. |
pascal@157 | 100 mkdir -p $fs/usr/share/udhcpc |
pascal@157 | 101 cp $stuff/udhcp.script $fs/usr/share/udhcpc/default.script |
pascal@157 | 102 chmod +x $fs/usr/share/udhcpc/default.script |
pascal@157 | 103 |
pascal@157 | 104 sed -i '2,$s/^#.*//;/^$/d' $fs/etc/init.d/rc* $fs/etc/init.d/daemon \ |
pascal@157 | 105 $fs/etc/init.d/*.sh |
pascal@157 | 106 sed -i 's/^#.*//;/^$/d' $fs/etc/*.conf $fs/etc/*tab \ |
pascal@157 | 107 $fs/etc/profile $fs/etc/securetty $fs/etc/shells |
pascal@157 | 108 |
pascal@157 | 109 cp $stuff/busybox-net-git.config $fs/boot/config-busybox |
pascal@157 | 110 } |
pascal@157 | 111 |
pascal@157 | 112 config_form() |
pascal@157 | 113 { |
pascal@157 | 114 if [ -z "$MODE" ]; then |
pascal@157 | 115 [ -n "$HOSTNAME" ] || HOSTNAME=slitaz |
pascal@157 | 116 [ -n "$INTERFACE" ] || INTERFACE=eth0 |
pascal@157 | 117 [ -n "$IP" ] || IP=192.168.0.6 |
pascal@157 | 118 [ -n "$NETMASK" ] || NETMASK=255.255.255.0 |
pascal@157 | 119 [ -n "$GATEWAY" ] || GATEWAY=192.168.0.1 |
pascal@157 | 120 [ -n "$DNS_SERVER" ] || DNS_SERVER='192.168.0.1 192.168.0.2' |
pascal@157 | 121 fi |
pascal@157 | 122 cat <<EOT |
pascal@157 | 123 <table> |
pascal@157 | 124 <tr> |
pascal@157 | 125 <td>Host name</td> |
pascal@157 | 126 <td><input type="text" name="HOSTNAME" value="$HOSTNAME" /></td> |
pascal@157 | 127 </tr> |
pascal@157 | 128 <tr> |
pascal@157 | 129 <td>Interface</td> |
pascal@157 | 130 <td><input type="text" name="INTERFACE" value="$INTERFACE" /></td> |
pascal@157 | 131 </tr> |
pascal@157 | 132 <tr> |
pascal@157 | 133 <td>Network configuration</td> |
pascal@157 | 134 <td><select name="MODE"> |
pascal@157 | 135 <option value="STATIC">STATIC</option> |
pascal@157 | 136 <option value="DHCP"$([ "$MODE" = "DHCP" ] && echo ' selected="selected"')>DHCP</option> |
pascal@157 | 137 <option value="DISABLE"$([ "$MODE" = "DISABLE" ] && echo ' selected="selected"')>DISABLE</option> |
pascal@157 | 138 </select></td> |
pascal@157 | 139 </tr> |
pascal@157 | 140 <tr> |
pascal@157 | 141 <td>Internet address</td> |
pascal@157 | 142 <td><input type="text" name="IP" value="$IP" /></td> |
pascal@157 | 143 </tr> |
pascal@157 | 144 <tr> |
pascal@157 | 145 <td>Netmask</td> |
pascal@157 | 146 <td><input type="text" name="NETMASK" value="$NETMASK" /></td> |
pascal@157 | 147 </tr> |
pascal@157 | 148 <tr> |
pascal@157 | 149 <td>Gateway</td> |
pascal@157 | 150 <td><input type="text" name="GATEWAY" value="$GATEWAY" /></td> |
pascal@157 | 151 </tr> |
pascal@157 | 152 <tr> |
pascal@157 | 153 <td>DNS server(s)</td> |
pascal@157 | 154 <td><input type="text" name="DNS_SERVER" value="$DNS_SERVER" /></td> |
pascal@157 | 155 </tr> |
pascal@157 | 156 </table> |
pascal@157 | 157 EOT |
pascal@157 | 158 } |
pascal@157 | 159 |
pascal@157 | 160 post_install() |
pascal@157 | 161 { |
pascal@157 | 162 sed -i 's|local.sh|network.sh &|' $1/etc/rcS.conf |
pascal@157 | 163 chmod 4755 $1/bin/busybox |
pascal@157 | 164 DHCP="no" |
pascal@157 | 165 STATIC="yes" |
pascal@157 | 166 case "$MODE" in |
pascal@157 | 167 "") return 1;; |
pascal@157 | 168 DISABLE) |
pascal@157 | 169 STATIC="no" ;; |
pascal@157 | 170 DHCP) DHCP="yes" |
pascal@157 | 171 STATIC="no" |
pascal@157 | 172 esac |
pascal@157 | 173 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \ |
pascal@157 | 174 -e "s/^INTERFACE=.*/INTERFACE=\"$INTERFACE\"/" \ |
pascal@157 | 175 -e "s/^NETMASK=.*/NETMASK=\"$NETMASK\"/" \ |
pascal@157 | 176 -e "s/^GATEWAY=.*/GATEWAY=\"$GATEWAY\"/" \ |
pascal@157 | 177 -e "s/^STATIC=.*/STATIC=\"$STATIC\"/" \ |
pascal@157 | 178 -e "s/^DHCP=.*/DHCP=\"$DHCP\"/" \ |
pascal@157 | 179 -e "s/^IP=.*/IP=\"$IP\"/" $1/etc/network.conf |
pascal@157 | 180 [ -n "$HOSTNAME" ] && echo $HOSTNAME > $1/etc/hostname |
pascal@157 | 181 } |