You are not logged in.

#1 2004-10-06 14:27:28

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

[new] netbrake

I needed a command line utility to limit the bandwidth used by a process (scp in my case), and found this one on Freshmeat. Seems to work.

# $Id $
# Contributor: bjorn <b.lindeijer@xs4all.nl>
pkgname=netbrake
pkgver=0.2
pkgrel=1
pkgdesc="A command line utility to limit the bandwidth used by a process"
url="http://www.hping.org/netbrake/"
depends=('glibc')
source=(http://www.hping.org/netbrake/$pkgname-$pkgver.tar.gz 
        Makefile.in.patch)
md5sums=('42f61481cdb910bddd1105d48367bdd2' 
         '219e3bfcfa7746e28a50d360c55fd6c5')

build() {
  cd $startdir/src/$pkgname

  # Patch Makefile.in to correct location of install tool
  patch -p0 < ../Makefile.in.patch

  # Configure with parameters
  ./configure << EOF

$startdir/pkg/usr/lib
$startdir/pkg/usr/bin

EOF

  make || return 1

  # Create directories
  mkdir -p $startdir/pkg/usr/lib
  mkdir -p $startdir/pkg/usr/bin

  make install
}

Makefile.in.patch:

--- Makefile.in 2001-09-10 15:40:50.000000000 +0200
+++ Makefile.in.new     2004-10-06 15:58:17.000000000 +0200
@@ -18,7 +18,7 @@
 AR=/usr/bin/ar
 SHELL= /bin/sh
 
-INSTALL= /usr/bin/install
+INSTALL= /bin/install
 INSTALL_PROGRAM= $(INSTALL) -m 755
 INSTALL_DATA= $(INSTALL) -m 644

This package and more at http://www.lindeijer.nl/~bjorn/abs/.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#2 2004-10-06 18:06:21

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: [new] netbrake

Interesting program. Thanks. I'd like to suggest some changes in the pkgbuild though:

pkgname=netbrake
pkgver=0.2
pkgrel=1
pkgdesc="A command line utility to limit the bandwidth used by a process"
url="http://www.hping.org/netbrake/"
depends=('glibc')
source=(http://www.hping.org/netbrake/$pkgname-$pkgver.tar.gz)
md5sums=('42f61481cdb910bddd1105d48367bdd2')

build() {
  cd $startdir/src/$pkgname

  sed -i "s/^INSTALL=.*$/INSTALL=/bin/install -m755/" $startdir/src/$pkgname/Makefile.in

  ./configure << EOF
yes
$startdir/pkg/usr/lib
$startdir/pkg/usr/bin

EOF

  make || return 1

  install -d -m755 $startdir/pkg/usr/bin
  install -d -m755 $startdir/pkg/usr/lib

  make install
}

1. Added url.
2. Filled depends.
3. Changing patch to sed command to get rid of potential errors during copy/paste from the forums and to have only one file and also to ensure proper permissions (-m 755) since the default makefile does not include it.
4. Addes "yes" to enable https (default was off).
5. Changing mkdir commands to install commands (cosmetic).

Offline

#3 2004-10-06 23:13:43

Bjørn
Member
From: The Netherlands
Registered: 2004-03-18
Posts: 139
Website

Re: [new] netbrake

Ok, thanks for the suggestions. I've added the url and glibc dependency, but don't really like the other changes, they seem all based on preference to me. I deliberately left https disabled because it was disabled by default. Also, there are no weird newlines in the patch so copy/pasting should be fine, and you could download it anyway. I don't really like the sed command because it's not very clear what it does and too long in my opinion.

I don't understand the -m755 permission setting, as it seems to me this is already the case when building the package without this option.

Edit: Actually, this is probably because the install does indeed already seem include the -m755 option by default for program installs, while data gets 644 permissions. See in my patch.


http://themanaworld.org/
A Free Real-time Massively Multiplayer Online RPG in development.

Offline

#4 2004-10-07 11:42:54

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: [new] netbrake

Bjørn wrote:

I don't understand the -m755 permission setting, as it seems to me this is already the case when building the package without this option.

Edit: Actually, this is probably because the install does indeed already seem include the -m755 option by default for program installs, while data gets 644 permissions. See in my patch.

Last two commands (from the patch file) are unsued later in the Makefile.
It uses pure INSTALL variable - that's why I added -m option. Of course it works this time even without -m but I prefer to make it clear in the pkgbuilds what should be executable and what doesn't need execute permissions.
This and the rest of the changes are the matter of your personal preferences. Anyway at least I learnt that there is https support in netbrake :-)

Offline

Board footer

Powered by FluxBB