summaryrefslogtreecommitdiff
path: root/sendmailadvanced.conf
blob: 831c0e8df8181a28c4ece9dc3b713cce542859c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash

# configuration for sendmailadvanced

# default recipient to encrypt to
gpg_recipients=(
  'me@example.com'
)

# stamp value
hashcash_bits=22

# things to put into head of (body of) email
body_header_hook()
{
  if [ "$(whoami)" == 'root' ]; then
    [ "$1" == 'last-backups' ] && return 0
    [ "$1" == 'paccheck' ] && return 0
  fi
  echo "Unkonwn header-hook: '$1'"
}

# things to put into foot of email
body_footer_hook()
{
  if [ "$(whoami)" == 'root' ]; then
    case "$1" in
      'last-backups')
        echo '----------------------- Last Backups Begin -------------------------'
        echo
        last-backups
        echo
        echo '------------------------ Last Backups End --------------------------'
        echo
        return 0
      ;;
      'paccheck')
        if command -v paccheck >/dev/null; then
          echo '----------------------- Pacman Check Begin -------------------------'
          echo
          paccheck --list-broken --sha256sum
          echo
          echo '------------------------ Pacman Check End --------------------------'
          echo
          return 0
        fi
      ;;
    esac
  fi
  echo "Unknown footer-hook: '$1'"
}