# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=dynagen
pkgver=0.11.0
pkgrel=0
pkgdesc="Dynagen is a front-end for use with the Dynamips Cisco router emulator"
url="http://www.dynagen.org/"
arch="noarch"
license="GPL-2.0"
depends="dynamips python2"
source="http://downloads.sourceforge.net/dyna-gen/${pkgname}-${pkgver}.tar.gz
	etc-path.patch"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python2/' *.py dynagen
	sed -i 's/\/usr\/bin\/env python/\/usr\/bin\/python2/' *.py
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/dynagen
	mkdir -p "$pkgdir"/usr/bin
	mkdir -p "$pkgdir"/etc/dynagen

	cp -a "$builddir"/* "$pkgdir"/usr/share/dynagen

	cd "$pkgdir"/usr/bin
	ln -s ../share/dynagen/dynagen

	mv "$pkgdir"/usr/share/dynagen/dynagen.ini "$pkgdir"/etc/dynagen
	chmod 644 "$pkgdir"/usr/share/dynagen/*
	chmod 755 "$pkgdir"/usr/share/dynagen/dynagen
	chmod 755 "$pkgdir"/usr/share/dynagen/pemu-start.sh
}

md5sums="3f88b3449b17096dca84d007f0b91b3f  dynagen-0.11.0.tar.gz
0fa338fedfbe37d95c29ad07c93fa094  etc-path.patch"
sha256sums="53523fe13e151c0476596315aa724d50c6523ab72bb64d0ffc8d3ea8ad4e9628  dynagen-0.11.0.tar.gz
4d2c1f07fb32241f29823e009b6e71b6b3421d5d690b0cb3236a8545116e87c6  etc-path.patch"
sha512sums="41ad7f31a1c4e30f6859ab706f71c86d15e174af4cc59a1f9604f71b0f12cb28fd3487fd13bc56f98940a323dfdbe85eaabd3831fe778fc9f1a96196257df60d  dynagen-0.11.0.tar.gz
a18c1970b573006d4e2995262aeac09e5f1904474e5f034ed1275f270e98c0eb42a39ff5764e48caf406212e03ea5f67bef699f7fbbeafc829ae2d8837ff9ea5  etc-path.patch"
