diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-06 09:53:36 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-06 09:53:36 +0000 |
commit | ec0c7a74bbf5824adc4efa54e1f91984ac870a8e (patch) | |
tree | 7f5a8763836154b10c8325629b493ebc67ead7e6 /setup-sendbug.in | |
parent | f590563940559429ffe77094473d12361937852d (diff) | |
download | alpine-conf-ec0c7a74bbf5824adc4efa54e1f91984ac870a8e.tar.bz2 alpine-conf-ec0c7a74bbf5824adc4efa54e1f91984ac870a8e.tar.xz |
move to .in files
Diffstat (limited to 'setup-sendbug.in')
-rwxr-xr-x | setup-sendbug.in | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/setup-sendbug.in b/setup-sendbug.in new file mode 100755 index 0000000..9ce94d8 --- /dev/null +++ b/setup-sendbug.in @@ -0,0 +1,41 @@ +#!/bin/sh + +PREFIX= +. "$PREFIX/lib/libalpine.sh" + +conf="$ROOT/etc/sendbug/sendbug.conf" + +cfgval() { + awk -F= "/^$1/ {print \$2}" "$ROOT/etc/ssmtp/ssmtp.conf" 2>/dev/null +} + +email=$(awk -F= '/^mailfrom/ {print $2}' "$conf" 2>/dev/null) + +if [ -z "$email" ] ; then + hostname=$(cfgval hostname) + if [ -z "$hostname" ]; then + hostname=$(hostname -f 2>/dev/null || cat /etc/hostname) + fi +else + hostname=$(hostname -f 2>/dev/null || cat /etc/hostname) +fi +domain=$(hostname -d $hostname 2>/dev/null) +if [ -n "$hostname" -a -z "$email" ] ; then + email=$(whoami)@$hostname +fi + +echon "Sender email address for problem reports? [$email] " +default_read email $email + +if grep ^mailfrom "$conf" > /dev/null 2>&1; then + sed -i "s/^mailfrom.*/mailfrom=$email/" "$conf" +else + mkdir -p $(dirname "$conf") + echo "mailfrom=$email" >> "$conf" +fi + +setup-mta + +echo "" +echo "Please run 'sendbug' to submit problem reports" + |