#/!bin/bash
cd /usr/src/util-linux-*/ ||exit

#to make it completely FHS compliant replace all /etc/adjtime (docu) with /var/lib/hwclock/adjtime
sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' hwclock/hwclock.c

#fix mtab update on mount --move:
patch -p 1 <../util-linux-2.12h-mount_move-1.patch

patch -p 1 <../util-linux-2.12r-gcc4_fixes-1.patch

#old: my own fix minix to compile with gcc35 (invalid lvalue):
#patch -p 1 <../util-linux-2.12a-minix_gcc35-1.patch

#fix compilation:
patch -p 1 <../util-linux-2.12r-cramfs-1.patch

#mount ext3 as ext3 (not ext2):
patch -p 1 <../util-linux-2.12p-blkid_mount_sec_type_fix-1.patch


mkdir -p /var/lib/hwclock &&
./configure &&
#HAVE_SLN=yes: prevents building sln (static ln), already installed by glibc
#HAVE_KILL=yes: prevents building kill, already installed by procps
make HAVE_KILL=yes HAVE_SLN=yes &&
make HAVE_KILL=yes HAVE_SLN=yes install
