openbsd-ports/mail/msmtp/patches/patch-scripts_set_sendmail_sh
jasper 10fafcca3f - update msmtp to 1.4.13
- update license marker to GPLv3
- install some sample scripts

from Simon Kuhnle (maintainer), with tweaks by me
2007-08-28 18:45:34 +00:00

102 lines
3.0 KiB
Plaintext

$OpenBSD: patch-scripts_set_sendmail_sh,v 1.1 2007/08/28 18:45:34 jasper Exp $
--- scripts/set_sendmail.sh.orig Wed Aug 1 10:54:56 2007
+++ scripts/set_sendmail.sh Tue Aug 28 20:26:32 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# Created : Tue 03 Jul 2007 11:54:53 PM EDT
# Modified : Wed 04 Jul 2007 01:27:09 PM EDT
# Author : Gautam Iyer <gi1242@users.sourceforge.net>
@@ -32,30 +32,30 @@ run_hosts='^baradur$'
# The following are the settings I use on my laptop.
# Use default account if we could not get the domain name.
-accounts+=(default)
-patterns+=('^$')
+accounts=${accounts}${default}
+patterns=${patterns}'^$'
# Use account 'stanford' from within the Stanford.EDU domain.
-accounts+=(stanford)
-patterns+=('^Stanford\.EDU$')
+accounts=${accounts}${stanford}
+patterns=${patterns}'^Stanford\.EDU$'
# ri.cox.net seems to have firewalled port 25, so use ssh tunnelling in this
# domain. (The function ssh_tunnel (called automatically) sets up the tunnel)
-accounts+=(ssh)
-patterns+=('^ri\.cox\.net$')
+accounts=${accounts}${ssh}
+patterns=${patterns}'^ri\.cox\.net$'
# From outside the Stanford.EDU domain, use account 'roam' with Kerberos
# authentication. It involves typing my password once a day (when my kerberos
# tickets expire), but is faster than ssh tunneling. (This requires traffic
# through port 25 to not be firewalled)
-accounts+=(roam)
-patterns+=('.')
+accounts=${accounts}${roam}
+patterns=${patterns}'.'
# Ignore case while matching.
-shopt -s nocasematch
+#shopt -s nocasematch
# Function called when account named "ssh" is used
-function ssh_tunnel()
+function ssh_tunnel
{
# Kill an already running tunnel (connection might be inactive)
pkill -f '^ssh.*8025:math:25'
@@ -68,7 +68,7 @@ function ssh_tunnel()
# End user settings
#
# {{{1 Script Functions
-function print_help()
+function print_help
{
cat << 'EOF'
USAGE:
@@ -97,7 +97,7 @@ EOF
}
# Check if a host is reachable
-function check_host()
+function check_host
{
if [[ $host_pkg == 'bind' ]]; then
host $1 >& /dev/null
@@ -110,7 +110,7 @@ function check_host()
}
# Function to get the domain name (in variable domainname).
-function get_domainname()
+function get_domainname
{
domainname=
ipaddr=
@@ -131,8 +131,8 @@ function get_domainname()
# Get ip address
#ipaddr=$(/sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | \
# cut -d: -f2 | awk '{ print $1}')
- #ipaddr=$(w3m -dump whatismyip.org)
- ipaddr=$(wget -qO- http://whatismyip.org)
+ ipaddr=$(lynx -dump whatismyip.org)
+ #ipaddr=$(wget -qO- http://whatismyip.org)
[[ -z $ipaddr ]] && return
if [[ $host_pkg == bind ]]; then
@@ -143,10 +143,10 @@ function get_domainname()
}
# {{{1 Main script
-(( $# )) && print_help
+[ $# -ne 0 ] && print_help
# If we can't (or shouldn't) msmtp, then print default and exit
-if [[ ! $HOST =~ $run_hosts ]] || ! which msmtp >& /dev/null; then
+if [[ ! $HOST == $run_hosts ]] || ! which msmtp >& /dev/null; then
echo $default
exit
fi