#!/bin/sh

shout() { echo "$0: $@" >&2; }
barf() { shout "fatal: $@"; exit 111; }
safe() { "$@" || barf "cannot $@"; }

here=`env - PATH=$PATH pwd`

safe umask 022
[ -d package ] || barf "no package directory"
[ -d src     ] || barf "no src directory"
[ -d compile ] || barf "no compile directory"
[ -f conf-home ] || barf "no conf-home file"

safe cd command

for xfile in `ls -1`
do
  safe install -vo root $xfile `head -n 1 ../conf-home` 
done

safe cd $here

shout "binc IMAP binary files installed in `head -n 1 conf-home`." 

exit 0
