#! /bin/sh

# Shell script to make sending GUP updates easier.
# Just read GUP command(s) from stdin and mail it off with passwd, etc.

#PATH=/bin			# Something like this for extra security.
: ${GUP_ADDR="news-update@werple"}	# Address to send updates to.
: ${GUP_FILE=$HOME/".gup"}		# File with "host <hostname> <passwd>".
: ${MAIL_PROG="mail"}			# Can put full pathname here instead.

				# Check for input from tty.
[ -t 0 ] && echo "Enter command(s) to feed to $GUP_ADDR via GUP."
				# Ensure GUP file exists.
[ ! -f $GUP_FILE ] && echo "GUP file '$GUP_FILE' not found." && exit 1
				# Mail off "host" line and commands.
cat $GUP_FILE - | $MAIL_PROG $GUP_ADDR
