description="System utilities for handling file systems consoles partitions and messages."
url="http://freshmeat.net/projects/util-linux/"

maintainer="Karel Zak kzak at redhat dot com"
packager="tnut <tnut@nutyx.org>"
contributors="Greg"

name=util-linux
version=2.36

source=(https://www.kernel.org/pub/linux/utils/util-linux/v${version:0:4}/util-linux-$version.tar.xz)

PKGMK_GROUPS=(devel doc man)

build()
{
cd util-linux-$version

# Blue is a very bad color for the info message ...
sed -i "s@COLOR_BLUE@COLOR_CYAN@" disk-utils/cfdisk.c

mkdir -pv $PKG/var/lib/hwclock
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
	--docdir=/usr/share/doc/$name-$version \
	--disable-chfn-chsh  \
	--disable-login      \
	--disable-nologin    \
	--disable-su         \
	--disable-setpriv    \
	--disable-runuser    \
	--disable-pylibmount \
	--disable-static     \
	--without-python

make
make DESTDIR=$PKG  install
# for file in /usr/lib/libuuid*
# do
# rm $file
# done

#
## service
SERVICEDIR=/lib/init/services

mkdir -p $PKG/etc/init/{single,multi}

for i in 1 2 3 4 5 6
do
  mkdir -p $PKG$SERVICEDIR/agetty-$i
  echo "#!/bin/sh
exec chpst -P /sbin/agetty -J tty$i 9600" > \
  $PKG$SERVICEDIR/agetty-$i/run
  chmod 755 $PKG$SERVICEDIR/agetty-$i/run
  ln -sv $SERVICEDIR/agetty-$i \
  $PKG/etc/init/single/agetty-$i
  ln -sv $SERVICEDIR/agetty-$i \
  $PKG/etc/init/multi/agetty-$i

done
}
devel()
{
cd $PKG
bsdtar -cf \
$PKGMK_PACKAGE_DIR/${name}.devel${PKGMK_BUILDVER}`uname -m`.$PKGMK_PACKAGE_EXT \
usr/include usr/lib usr/share/bash-completion
rm -r usr/{include,lib,share/bash-completion}
}
