#!/bin/sh -eu
#
# $Id: frcpyshmackey,v 1.1 2000/07/24 22:25:35 bill Exp $
#
# Copy the shared, secret MAC key to the appropriate location
# the nymserver or mail system machine.
#

PATH=/bin:/usr/bin

. ./.fns.sh

warning "using bogus destination"
dst=/tmp/$mkfile

trap "rm $dst" 0

if [ `id -u` -ne $uid ] ; then
  error "you must be root to run this script."
fi

if [ "$0" != "./${prog}" ] ; then
  error "you *must* run the script as ./${prog}, from the directory containing it"
fi

if [ `ls -l $mkfile | cut -f1 -d' '` != "----------" ] ; then
  error "permissions on $mkfile must be 0"
fi

echo "Copying secret MAC key to $dst."

(
  umask 0777
  cp $mkfile $dst
  chown $fruser $dst
  chmod 400 $dst
)
trap "" 0

exit 0
