Skip to content

Instantly share code, notes, and snippets.

@andres-erbsen
Created April 21, 2013 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andres-erbsen/5431038 to your computer and use it in GitHub Desktop.
Save andres-erbsen/5431038 to your computer and use it in GitHub Desktop.
PKGBUILD file to package mininet for Arch Linux
# PKGBUILD Maintainer: Andres Erbsen <andres@krutt.org>
pkgname=mininet-git
pkgver=2.0
pkgrel=0
pkgdesc="Mininet network emulator"
url="https://github.com/mininet/mininet/"
arch=('x86_64' 'i686')
license=('custom')
makedepends=('help2man')
depends=('bash' 'python2' 'python2-networkx' 'net-tools' 'iputils' 'iperf')
optdepends=('openvswitch')
conflicts=()
replaces=()
backup=()
_gitroot="https://github.com/mininet/mininet.git"
_gitname="mininet"
build() {
cd "$srcdir"
msg "Connecting to GIT server...."
if [ -d $_gitname ] ; then
( cd $_gitname && git pull ) || warning "Git pull failed!"
else
git clone --depth=1 $_gitroot
fi
msg "GIT checkout done or server timeout"
cd $_gitname
grep python2 Makefile && return
grep -rIil '#!.*python' . | xargs -n1 sed -i 's:#!/usr/bin/env python:#!/usr/bin/env python2:g'
grep -rIil '#!.*python' . | xargs -n1 sed -i 's:#!/usr/bin/python:#!/usr/bin/python2:g'
sed 's:BINDIR = /usr/bin:BINDIR = $(DESTDIR)/usr/bin:g' -i Makefile
sed 's:MANDIR = /usr/share/man/man1:MANDIR = $(DESTDIR)/usr/share/man/man1:g' -i Makefile
sed 's:install $(MNEXEC) $(BINDIR):mkdir -p $(BINDIR); install $(MNEXEC) $(BINDIR):g' -i Makefile
sed 's:install $(MANPAGES) $(MANDIR):mkdir -p $(MANDIR);install $(MANPAGES) $(MANDIR):g' -i Makefile
sed 's:python setup.py:python2 setup.py install --prefix=/usr --root="$(DESTDIR)" --optimize=1:g' -i Makefile
}
package() {
cd "$srcdir/$_gitname"
make DESTDIR="${pkgdir}" install
}
@gbc921
Copy link

gbc921 commented Nov 14, 2013

This pkgbuild is working.
One just need to inform that the ovsdb-server and ovs-vswitchd services need to be started before using mininet.

Can you submit this to AUR?
I can do it too whether you give me the right.

Sincerely,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment