#!/bin/sh

#
# $Id: guessvariables,v 1.6 2003/06/07 21:34:06 alan Exp alan $
#

# Script to create variables use by MARP



######################################################################
# Who am I?
MARP_WHOAMI=`whoami`
# Computer name
MARP_HOST=`hostname`

# for testing
# MAIL=  

# Directory of user's mailboxes.
# example # MARP_MAIL_DIR="/home/somebody/mail"
MARP_MAIL_DIR="${HOME}/mail"

# User's system mailbox
# example # MARP_WHITE_MAILBOX="/var/spool/mail/somebody"
MARP_WHITE_MAILBOX=${MAIL:-"/var/spool/mail/${MARP_WHOAMI}"}

# From: and From_ headers
# This alias must resolve to the user via sendmail's aliases.
# The user needs to be trusted to avoid sendmail warning header.
# I like to identify the autoresponder as a daemon to help recipient
# mail processors.
# example # MARP_REPLY_FROM="MARP-somebody-DAEMON@example.com"
# Plus addressing may be a possible alternative.
# example # MARP_REPLY_TO="somebody+MARP-DAEMON@example.com"
# If any of the above is not possible, your ordinary user name can 
# be used.
# example # MARP_REPLY_FROM="somebody@example.com"
# Ensure this address is not masqueraded by sendmail.
MARP_REPLY_FROM="${MARP_WHOAMI}@${MARP_HOST}"

# Reply_To: header.
# This alias must resolve to the user via sendmail's aliases
# example # MARP_REPLY_TO="marp-somebody@example.com"
# Plus addressing may be a possible alternative.
# example # MARP_REPLY_TO="somebody+marp@example.com"
# If the above is not possible, your ordinary user name can 
# be used.
# example # MARP_REPLY_TO="somebody@example.com"
# Ensure this address is not masqueraded by sendmail.
MARP_REPLY_TO="${MARP_WHOAMI}@${MARP_HOST}"

# The munged password should be the password with some question
# marks in it. The password is created from this automatically.
# example # MARP_MUNGED_PASSWORD="rockand??roll"
MARP_MUNGED_PASSWORD="rockand??roll"

# Password.
# example # MARP_PASSWORD="rockandroll"
# example # MARP_PASSWORD=`echo "${MARP_MUNGED_PASSWORD}" | tr -d ?`
MARP_PASSWORD=`echo "${MARP_MUNGED_PASSWORD}" | tr -d ?`

# The subject of the response is the following text added to the
# subject of the original message.
# example # MARP_NEW_SUBJECT="(password is rockand??roll - please remove the question marks and reply)"
# example # MARP_NEW_SUBJECT="(password is ${MARP_MUNGED_PASSWORD} - please remove the question marks and reply)"
MARP_NEW_SUBJECT='(password is ${MARP_MUNGED_PASSWORD} - please remove the question marks and reply)'


# Xloop header for avoiding mail loops.
# example # MARP_XLOOP="somebody_marp@computer.example.com"
MARP_XLOOP="${MARP_WHOAMI}_marp@${MARP_HOST}"


# Your name.  This is used in the text of the reply.
# example # MARP_LONGNAME="Alan Clifford"
MARP_LONGNAME=`grep -w "${MARP_WHOAMI}" /etc/passwd | cut -d : -f 5`

# Your name.  This is used in the text of the reply.
# example # MARP_SHORTNAME="Alan"
MARP_SHORTNAME=`echo ${MARP_LONGNAME} | cut -d " " -f 1`

# Computer name.  This is used in the text of the reply
# example # MARP_COMPUTER="computer.example.com"
MARP_COMPUTER=${MARP_HOST:-"The computer"}

# Status header can be modified if desired.
# example # MARP_STATUS_HEADER=X-MARP-Status:
MARP_STATUS_HEADER=X-MARP-Status:

# If you don't want to send yourself a copy of the autoresponses,
# comment out the MARP_BCC line.
MARP_BCC=${MARP_REPLY_FROM}

######################################################################

cat <<-xxxxCONFIGURERCxxxxx > userdata.rc

##################  User configuration  ##############################
# Directory of user's mailboxes.
# example # MARP_MAIL_DIR="/home/somebody/mail"
MARP_MAIL_DIR="${MARP_MAIL_DIR}"

# User's system mailbox
# example # MARP_WHITE_MAILBOX="/var/spool/mail/somebody"
MARP_WHITE_MAILBOX="${MARP_WHITE_MAILBOX}"

# From: and From_ headers
# This alias must resolve to the user via sendmail's aliases.
# The user needs to be trusted to avoid sendmail warning header.
# I like to identify the autoresponder as a daemon to help recipient
# mail processors.
# example # MARP_REPLY_FROM="MARP-somebody-DAEMON@example.com"
# Plus addressing may be a possible alternative.
# example # MARP_REPLY_TO="somebody+MARP-DAEMON@example.com"
# If any of the above is not possible, your ordinary user name can 
# be used.
# example # MARP_REPLY_FROM="somebody@example.com"
# Ensure this address is not masqueraded by sendmail.
MARP_REPLY_FROM="${MARP_REPLY_FROM}"

# Reply_To: header.
# This alias must resolve to the user via sendmail's aliases
# example # MARP_REPLY_TO="marp-somebody@example.com"
# Plus addressing may be a possible alternative.
# example # MARP_REPLY_TO="somebody+marp@example.com"
# If the above is not possible, your ordinary user name can 
# be used.
# example # MARP_REPLY_TO="somebody@example.com"
# Ensure this address is not masqueraded by sendmail.
MARP_REPLY_TO="${MARP_REPLY_TO}"

# The munged password should be the password with some question
# marks in it.
# example # MARP_MUNGED_PASSWORD="rockand??roll"
MARP_MUNGED_PASSWORD="${MARP_MUNGED_PASSWORD}"

# Password.
# example # MARP_PASSWORD="rockandroll"
# example # MARP_PASSWORD=\`echo "\${MARP_MUNGED_PASSWORD}" | tr -d ?\`
MARP_PASSWORD="${MARP_PASSWORD}"

# The subject of the response is the following text added to the
# subject of the original message.
# example # MARP_NEW_SUBJECT="(password is rockand??roll - please remove the question marks and reply)"
# example # MARP_NEW_SUBJECT="(password is \${MARP_MUNGED_PASSWORD} - please remove the question marks and reply)"
MARP_NEW_SUBJECT="${MARP_NEW_SUBJECT}"

# Xloop header for avoiding mail loops.
# example # MARP_XLOOP="somebody_marp@computer.example.com"
MARP_XLOOP="${MARP_XLOOP}"

# Your name.  This is used in the text of the reply.
# example # MARP_LONGNAME="Alan Clifford"
MARP_LONGNAME="${MARP_LONGNAME}"

# Your name.  This is used in the text of the reply.
# example # MARP_SHORTNAME="Alan"
MARP_SHORTNAME="${MARP_SHORTNAME}"

# Computer name.  This is used in the text of the reply
# example # MARP_COMPUTER="computer.example.com"
MARP_COMPUTER="${MARP_COMPUTER}"

# Status header can be modified if desired.
# example # MARP_STATUS_HEADER=X-MARP-Status:
MARP_STATUS_HEADER="${MARP_STATUS_HEADER}"

# If you don't want to send yourself a copy of the autoresponses,
# comment out the MARP_BCC line.
MARP_BCC="${MARP_BCC}"
##############  User configuration ends here #########################

xxxxCONFIGURERCxxxxx


cat <<-xxxxCONFIGURESHxxxxx > userdata.sh
##################  User configuration  ##############################
# Directory of user's mailboxes.
# example # MARP_MAIL_DIR="/home/somebody/mail"
MARP_MAIL_DIR="${MARP_MAIL_DIR}"

# User's system mailbox
# example # MARP_WHITE_MAILBOX="/var/spool/mail/somebody"
MARP_WHITE_MAILBOX="${MARP_WHITE_MAILBOX}"
##############  User configuration ends here #########################

xxxxCONFIGURESHxxxxx

cat userdata.rc
echo; echo
cat userdata.sh

echo "It will be neccesary to edit userdata.rc and userdata.sh"
echo


