NAME=sysvinit
VERSION=2.86
SOURCE=(ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-$VERSION.tar.gz
	_sysvinit.tar.gz )
PATCH=sysvinit.patch
BUILD=${BUILD:-1}
OPTIMIZE=${OPTIMIZE:-"-Os"}
ROOT_REQUIRED=1

build() {
	_explode 1 $PKG
	_explode 0
	cd sysvinit-$VERSION
	_patch 0 -p1
	
	cd src
	sed -i "/^CFLAGS/{s|$| $CFLAGS|}" Makefile
	make MANDIR=$MANDIR
	mkdir -p $PKG$BINDIR $PKG/bin $PKG/sbin $PKG$MANDIR/man{1,5,8} $PKG$INCLUDEDIR
	make MANDIR=$MANDIR ROOT=$PKG install
	
	cd ../doc
	_doc 0 sysvinit-$VERSION  Changelog Install Propaganda bootlogd.README sysvinit-2.86.lsm

	_new 0 $SYSCONFDIR/{inittab,rc.d/rc.{conf,local,sysvinit}}
	cat << EOF >> $PKG/install/doinst.sh

# Notice we use an absolute path below, rather than usr/bin/last.  This is because
# we're testing to see if we are on the bootdisk, which will not have /usr/bin/last.
# If we aren't, we will signal init to restart using the new binary.
if [ -x $BINDIR/last ]; then
	/sbin/init u
fi

EOF

}
