pkgname=runit
pkgver=1.8.0
pkgrel=64
pkgdesc="A replacement for sysvinit, and other init schemes, with service supervision"
url="http://smarden.org/runit/"
license="BSD"
depends=('glibc' 'util-linux' 'initscripts' )
makedepends=()
conflicts=()
replaces=()
backup=()
install=runit.install
source=(http://smarden.org/runit/$pkgname-$pkgver.tar.gz add_service.sh remove_service.sh halt.script reboot.script poweroff.script shutdown.script)
arch=('i686')

build() {
  cd $startdir/src/admin/$pkgname-$pkgver/src
  echo "${CC:-gcc} ${CFLAGS:--Os}" > conf-cc
  echo "${LD:-gcc -s}" > conf-ld
  make || return 1
  ./compile svwaitdown.c
  ./load svwaitdown unix.a byte.a time.a
  ./compile svwaitup.c
  ./load svwaitup unix.a byte.a time.a
  ./compile utmpset.c
  ./load utmpset unix.a byte.a




  install -d $startdir/pkg/sbin/
  install -d $startdir/pkg/usr/man/man8
  install -m0755 $startdir/src/add_service.sh $startdir/pkg/sbin
  install -m0755 $startdir/src/remove_service.sh $startdir/pkg/sbin
  install -m0755 $startdir/src/reboot.script $startdir/pkg/sbin
  install -m0755 $startdir/src/halt.script  $startdir/pkg/sbin
  install -m0755 $startdir/src/poweroff.script  $startdir/pkg/sbin
  install -m0755 $startdir/src/shutdown.script  $startdir/pkg/sbin

  for i in `cat ../package/commands`; do
    install -m0755 $i $startdir/pkg/sbin/
  done
  
  install -m0755 svwaitup $startdir/pkg/sbin/
  install -m0755 svwaitdown $startdir/pkg/sbin/
  install -m0644 ../man/*.8 $startdir/pkg/usr/man/man8

#  rsync -a --exclude=.svn $startdir/runitscripts $startdir/src
#  cd $startdir/src/runitscripts

  install -d $startdir/pkg/etc/
  install -d $startdir/pkg/etc/runit/
  install -d $startdir/pkg/var/service


#  install -m0700 1 2 3 ctrlaltdel $startdir/pkg/etc/runit
#  install -m0755 reboot-runit halt-runit logger $startdir/pkg/sbin

 # install -d $startdir/pkg/etc/sv
 # rsync -a --exclude=.svn services/* $startdir/pkg/etc/sv

  cd $startdir
  install -d $startdir/pkg/usr/bin


}
md5sums=('46549303a336bee8f627bfb399d44085'
         '5828ac37537d60ded00252dc02d462c6'
         '984dbe096b0db26ad9f3f5b51addd9c9'
         'e347ea8cf2981f2cd4105111ea1ce1d4'
         '263198ec006b87891ea0f3ab1d103086'
         '3ec5f3013dcbd60b6b957d17ba220585'
         'febe6821f4bea3bfa93f4b6d3df4d801')