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


#suppress the building of uptime and kill; ./src/su' will not be installed:
patch -p 1 <../coreutils-5.96-suppress_uptime_kill_su-1.patch 

patch -p 1 <../coreutils-5.96-uname-1.patch


#one could use DEFAULT_POSIX2_VERSION=199209 \ here instead of patching
./configure --prefix=/usr &&
make &&
make install &&
#move some programs to their proper locations:
mv /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin &&
mv /usr/bin/{date,echo,false,head,install,ln,ls} /bin &&
cp -f /usr/bin/{mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin &&
rm -f /usr/bin/{mkdir,mknod,mv,pwd,rm,rmdir,sync} &&
/bin/mv /usr/bin/{sleep,stty,test,touch,true,uname} /bin &&
/bin/mv /usr/bin/chroot /usr/sbin &&
#Finally, create a necessary symlinks (FHS compliant):
ln -sf /bin/install /usr/bin/install

#old:
#move dir,dircolors,du
#ln -sf test /bin/[ &&
