diff options
author | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2009-07-23 17:25:06 +0000 |
---|---|---|
committer | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2009-07-23 17:25:06 +0000 |
commit | 7973760a8f09fc72f1571f7fe44d6717d77b5978 (patch) | |
tree | 8bd98a41046425040f866af31c00e99402338dce | |
parent | 5491100afa473c45f96667ce6f89703d42e01503 (diff) | |
download | slackbuilds-7973760a8f09fc72f1571f7fe44d6717d77b5978.tar.gz slackbuilds-7973760a8f09fc72f1571f7fe44d6717d77b5978.tar.bz2 |
nload: adding nload
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2231 370017ae-e619-0410-ac65-c121f96126d4
-rw-r--r-- | net/analyzer/nload/Manifest | 23 | ||||
-rw-r--r-- | net/analyzer/nload/nload.SlackBuild | 223 |
2 files changed, 246 insertions, 0 deletions
diff --git a/net/analyzer/nload/Manifest b/net/analyzer/nload/Manifest new file mode 100644 index 00000000..31de2edb --- /dev/null +++ b/net/analyzer/nload/Manifest @@ -0,0 +1,23 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +DIST nload-0.7.2.tar.gz 145262 MD5 5b851ecf898edcd1f465946745e95eb6 RMD160 e4e7cee98de4b83106998f4552f4e1e0071f61f4 SHA1 fe1f6e93a9233b55a61580a23e94edc965583fa3 SHA256 54af659b9b490702c3aa01a9d5b64b3b328bd08b9d2295a7fc848c1c7a3c8352 SHA512 27a6658b4c9074cdacad7763d6965c57455353bb13f0038a0b1857c2d1166e8a9d4d7b774151f2c37ad4b787db463ae1e71c9d702525738ba8dbf0300d7328c9 +MKBUILD nload.mkbuild 5008 MD5 193609802564340423ecc54732ee20e0 RMD160 9a4301cfb63356b885db077015bb6ce49528a748 SHA1 6957e796e4f3ff8cd3867893b009b4b18272db9e SHA256 62c3cec39bf194845a977aea8efd3a871f989171602e58bab6f4f13ed6e1a8de SHA512 d8526853cebba9a992596abb7eff939cdbc6e82e7fc5491e99170bcb43292d73db3e40a40ad873078c41e5dbf790557feacb2a558e19c2da07e1177aa7dd74f7 +SLACKBUILD nload.SlackBuild 6964 MD5 46fcbdfac234d98d8611677193068587 RMD160 59c739380d6b5880f1d9bca7f67febd3842f1ec2 SHA1 4ac53ed4dcd0adc9b1ad4afe92b88553c999ec62 SHA256 2e695cda3ef4c7a84f29bb88eb1553193b27055186cefbe2ec12ff205ebbfb6c SHA512 5da72dd7390e98e235841fd41c447fc6ffb4c58fda58ce63bc7486fabf8ea19db001939d014c5e1b1444fddc382eb2371ccc1590c12bbd06b6f0416d6e22cedc +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBCAAGBQJKaJzgAAoJEEHL93ESzgei2dAQAI9Kr/beaOQmKM2s+Q1U05MN +of4BxfP3z79clBRHmfIWwClzjBsM0r4mMdI105t8GeB90sWGfCHFlBidxy5AiroJ +U83d9x1rWwgXzQOJTy/H6tQAN0DgwDPVQQ1ZGjG0uu/tqBp1qUKEaUv54eNAd4EA +mrpEokpPyG2EHHsWq9Lz9+nu8hFPo5+Ie0YwWz+EBWKIWO5BSlYjh0MJd4tOVSGb +Ip4TrIeMBCZPknvyf+7X2E1mDUIXpdVckl/Je9y2qfqlx6IgVU3Ku8aFFCK07k7w +5I2+yF/RT+zbEUyL5Qi6fGpEJYLJ0uIiS7XvE8I4KncEbZxP1JppvQ9guD6dABON +ap7q4Ak5sqsXan/CdP9iXUluDhsHnzDwUlU7V/D8PPyiNsdyKZgwzSDOZj1eQ6qt +Xk4RVz49Hb05fjaugLivzKwawtZ8pvlH39quFE+fA6iAgyn+qJwCCAPhvR94LCD4 +OacURdjXdZVEtx4SFwZxg42uUehR3UBmBDKvvyS9vTL3Ogh1LENXtu1FlptN9gJe +xVm/AnT5H3vkA8FbSRE+Qy+cudi050brf+vOMAL6sRfjxIF0Rd3UsroKFwdUHFLE +Oheg5kwwYfsIL3a8Z6tpwLAQcnFpSkpekUOsjf28t71REDrEgmnSfrN4zcVTXsQe +NigQNLtFbj6z77/Wcp0b +=Z1oT +-----END PGP SIGNATURE----- diff --git a/net/analyzer/nload/nload.SlackBuild b/net/analyzer/nload/nload.SlackBuild new file mode 100644 index 00000000..16376ea8 --- /dev/null +++ b/net/analyzer/nload/nload.SlackBuild @@ -0,0 +1,223 @@ +#!/bin/bash +# +# nload.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. +# +# nload.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# +# slackbuild for nload, by Silvio Rhatto +# requires: +# tested: nload-0.7.2 +# model: generic.mkSlackBuild $Rev: 805 $ +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="nload" +PKG_NAME="nload" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=0.7.2} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1rha} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME +TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} +REPOS=${REPOS:=$TMP} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="net/analyzer/nload"} +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:=""} +NUMJOBS=${NUMJOBS:=""} + +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mtune=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" +fi + +# Set error codes (used by createpkg) +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 +ERROR_MANIFEST=43; + +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR + +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION.tar.gz" +URL="http://www.roland-riegel.de/nload/$SRC" + +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +fi + +# Check Manifest file +if [ -e "$CWD/Manifest" ]; then + + # Manifest signature checking + if grep -q -- "-----BEGIN PGP SIGNED MESSAGE-----" $CWD/Manifest; then + echo "Checking Manifest signature..." + gpg --verify $CWD/Manifest + if [ "$?" != "0" ]; then + exit $ERROR_MANIFEST + fi + fi + + MANIFEST_LINES="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | wc -l`" + + for ((MANIFEST_COUNT=1; MANIFEST_COUNT <= $MANIFEST_LINES; MANIFEST_COUNT++)); do + + MANIFEST_LINE="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | head -n $MANIFEST_COUNT | tail -n 1`" + MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`" + MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`" + + if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then + MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE" + else + MANIFEST_FILE="`find $CWD -name $MANIFEST_FILE`" + fi + + if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then + continue + fi + + echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..." + + SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`" + SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`" + + # Check source code size + if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then + echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC" + exit $ERROR_MANIFEST + else + echo "Size match." + fi + + # Check source code integrity + for ALGO in md5 rmd160 sha1 sha256 sha512; do + if [ $ALGO = "rmd160" ]; then + ALGO_SRC="`openssl rmd160 $MANIFEST_FILE | awk '{ print $2 }'`" + else + ALGO_SRC="`"$ALGO"sum $MANIFEST_FILE | awk '{ print $1 }'`" + fi + ALGO="`echo $ALGO | tr '[:lower:]' '[:upper:]'`" + ALGO_MANIFEST=$(echo $MANIFEST_LINE | sed "s/.* $ALGO //" | awk '{ print $1 }') + if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then + echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC" + exit $ERROR_MANIFEST + else + echo "$ALGO match." + fi + done + + done + +else + exit $ERROR_MANIFEST +fi + +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" +cd "$PKG_SRC" + +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF + +# Compile +make $NUMJOBS || exit $ERROR_MAKE + +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL + +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Install documentation +DOCS="AUTHORS COPYING ChangeLog NEWS README" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done + +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler--------------------------------------------------------| +nload: nload +nload: +nload: nload is a console application which monitors network +nload: traffic and bandwidth usage in real time. It visualizes +nload: the in- and outgoing traffic using two graphs and +nload: provides additional info like total amount of transfered +nload: data and min/max network usage. +nload: +nload: +nload: +nload: +EODESC + +# Build the package +cd "$PKG" +mkdir -p $REPOS/$SLACKBUILD_PATH +makepkg -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG + +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi |