pkgname=etcnet
pkgver=0.9.10
pkgrel=2
pkgdesc="/etc/net network configuration subsystem"
url="http://etcnet.org/"
depends=('bash' 'grep' 'sed' 'iproute2' 'wireless_tools' 'iptables' 'dhcpcd')
arch=i686
install=etcnet.install
#source=(http://etcnet.org/files/$pkgname-$pkgver.tar.gz 10-defaults network functions.patch options ipv4route ipv4address )
source=($pkgname-$pkgver.tar.gz 10-defaults network functions.patch options ipv4route ipv4address )
#backup=(etc/net/ifaces/eth0/options etc/net/ifaces/eth0/ipv4route etc/net/ifaces/eth0/ipv4address)

build() {
  cd $startdir/src/$pkgname
  mkdir -p $startdir/pkg/var/lib/etcnet
  mkdir -p $startdir/pkg/etc/sysconfig
  cd etc/net
  patch -p0 < $startdir/src/functions.patch || return 1
   
  install -D -m 644 $startdir/src/10-defaults  $startdir/pkg/etc/net/options.d/10-defaults
  install -D -m 644 $startdir/src/network $startdir/pkg/etc/sysconfig/network
  install -D -m 644 $startdir/src/etcnet/docs/etcnet.8 $startdir/pkg/usr/man/man8/etcnet.8
  install -D -m 644 $startdir/src/etcnet/docs/etcnet-options.5 $startdir/pkg/usr/man/man5/etcnet-options.5
  cp -rp $startdir/src/$pkgname/docs   $startdir/pkg/etc/net
  cp -rp $startdir/src/$pkgname/examples   $startdir/pkg/etc/net

   #setup default for eth0  
  mkdir -p $startdir/pkg/etc/net/ifaces/eth0
#  cp $startdir/src/options $startdir/pkg/etc/net/ifaces/eth0/options
#  cp $startdir/src/ipv4route $startdir/pkg/etc/net/ifaces/eth0/ipv4route
#  cp $startdir/src/ipv4address $startdir/pkg/etc/net/ifaces/eth0/ipv4address

  cd $startdir/src/$pkgname
  rm -Rf etc/sysconfig etc/net/{README.ALT,TODO,ChangeLog,ifaces/unknown}
  cp -Rf etc $startdir/pkg
  cd $startdir/pkg/etc/net/scripts
  ln -s ifup-ifplugd ifup-wireless
  ln -s ifdown-ifplugd ifdown-wireless
   
}
md5sums=('edb58f3515beb356d268704a1dae0466'
         '0e45b165b5496347407d1ac928f0d2a8'
         '6b7df6be8f895d46c9cc3169cfa952ed'
         '0869475449bddc92fa7d5153cfdb6b00'
         '4764050578c3d7293d9498b7028c65ec'
         'd4688d85bf69ab43fd0619c60d36b50e'
         '9ad5cbc0b19d73f2848a9e9e66274f23')