source: npl/system/net_tools/net-tools.SlackBuild.orig @ 2154c77

Last change on this file since 2154c77 was 2154c77, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

various updates

  • Property mode set to 100755
File size: 4.2 KB
Line 
1#!/bin/bash
2
3# Copyright 2006, 2007, 2008, 2009, 2010, 2012, 2017, 2018  Patrick J. Volkerding, Sebeka, MN, USA
4# All rights reserved.
5#
6# Redistribution and use of this script, with or without modification, is
7# permitted provided that the following conditions are met:
8#
9# 1. Redistributions of this script must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11#
12#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
13#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
15#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
18#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
20#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23cd $(dirname $0) ; CWD=$(pwd)
24
25PKGNAM=net-tools
26VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-3}
28
29# Automatically determine the architecture we're building on:
30if [ -z "$ARCH" ]; then
31  case "$( uname -m )" in
32    i?86) export ARCH=i586 ;;
33    arm*) export ARCH=arm ;;
34    # Unless $ARCH is already set, use uname -m for all other archs:
35       *) export ARCH=$( uname -m ) ;;
36  esac
37fi
38
39# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
40# the name of the created package would be, and then exit. This information
41# could be useful to other scripts.
42if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
43  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
44  exit 0
45fi
46
47TMP=${TMP:-/tmp}
48PKG=$TMP/package-${PKGNAM}
49rm -rf $PKG
50mkdir -p $TMP $PKG
51
52if [ "$ARCH" = "i386" ]; then
53  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
54elif [ "$ARCH" = "i586" ]; then
55  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
56elif [ "$ARCH" = "s390" ]; then
57  SLKCFLAGS="-O2"
58elif [ "$ARCH" = "x86_64" ]; then
59  SLKCFLAGS="-O2 -fPIC"
60else
61  SLKCFLAGS="-O2"
62fi
63
64cd $TMP
65rm -rf net-tools-$VERSION
66tar xvf $CWD/net-tools-$VERSION.tar.xz || exit 1
67cd net-tools-$VERSION || exit 1
68
69zcat $CWD/net-tools.config.h.gz > config.h
70
71chown -R root:root .
72find . \
73  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
74  -exec chmod 755 {} \+ -o \
75  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
76  -exec chmod 644 {} \+
77
78mkdir -p $PKG/usr/doc/net-tools-$VERSION
79cp -a \
80  COPYING* INSTALLING README* THANKS TODO \
81  $PKG/usr/doc/net-tools-$VERSION
82chmod 644 $PKG/usr/doc/net-tools-$VERSION/*
83chown root:root $PKG/usr/doc/net-tools-$VERSION/*
84HAVE_FW_MASQUERADE=1 HAVE_ARP_TOOLS=1 HAVE_HOSTNAME_TOOLS=1 \
85  HAVE_HOSTNAME_SYMLINKS=1 HAVE_IP_TOOLS=1 HAVE_MII=1 \
86  HAVE_PLIP_TOOLS=1 HAVE_SERIAL_TOOLS=1 make  || exit 1
87strip --strip-unneeded ipmaddr iptunnel hostname arp ifconfig nameif rarp route netstat plipconfig slattach mii-tool
88mkdir -p $PKG/sbin $PKG/bin $PKG/usr/sbin
89cat arp > $PKG/sbin/arp
90cat ifconfig > $PKG/sbin/ifconfig
91cat rarp > $PKG/sbin/rarp
92cat route > $PKG/sbin/route
93cat mii-tool > $PKG/sbin/mii-tool
94cat nameif > $PKG/sbin/nameif
95cat netstat > $PKG/bin/netstat
96cat plipconfig > $PKG/sbin/plipconfig
97cat slattach > $PKG/usr/sbin/slattach
98cat ipmaddr > $PKG/sbin/ipmaddr
99cat iptunnel > $PKG/sbin/iptunnel
100chmod 755 $PKG/sbin/* $PKG/bin/* $PKG/usr/sbin/*
101cd man/en_US
102mkdir -p $PKG/usr/man/man{1,5,8}
103cat ethers.5 | gzip -9c > $PKG/usr/man/man5/ethers.5.gz
104for page in arp.8 ifconfig.8 mii-tool.8 nameif.8 netstat.8 rarp.8 route.8 \
105  slattach.8 plipconfig.8 ; do
106  cat $page | gzip -9c > $PKG/usr/man/man8/$page.gz
107done
108
109# This is a little Slackware-specific tool used in some of the network
110# related scripts to calculate network and broadcast addresses:
111( cd $PKG/bin
112  cc -O2 -o ipmask $CWD/ipmask.c
113  strip --strip-unneeded ipmask
114  chmod 755 ipmask
115)
116cat $CWD/ipmask.8 | gzip -9c > $PKG/usr/man/man8/ipmask.8.gz
117
118mkdir -p $PKG/install
119cat $CWD/slack-desc > $PKG/install/slack-desc
120
121cd $PKG
122makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
123
Note: See TracBrowser for help on using the repository browser.