Loading Makefile.am +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ bin_SCRIPTS = mailboot noinst_SCRIPTS = PKGBUILD dist_doc_DATA = README.rst COPYRIGHT LICENSE AUTHORS systemdunit_DATA = mailboot.service dist_sysconf_DATA = mailboot.conf mailboot: mailboot.in $(do_substitution) < $(srcdir)/$< > $@ Loading @@ -34,6 +35,7 @@ PKGBUILD: PKGBUILD.in do_substitution = $(SED) \ -e 's,[@]bindir[@],$(bindir),g' \ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \ -e 's,[@]VERSION[@],$(VERSION),g' check: mailboot Loading PKGBUILD.in +2 −1 Original line number Diff line number Diff line Loading @@ -8,12 +8,13 @@ arch=('any') url='https://github.com/seblu/mailboot' license=('GPL') depends=('bash' 'systemd' 'sed') backup=('etc/mailboot.conf') source=("$pkgname-$pkgver.tar.xz") md5sums=('SKIP') build() { cd $pkgname-$pkgver ./configure --prefix=/usr ./configure --prefix=/usr --sysconfdir=/etc make } Loading mailboot.conf 0 → 100644 +7 −0 Original line number Diff line number Diff line ## config file for mailboot ## Specify mail destinations. Directly given to sendmail. ## Can be a local user or a mail@localhost.com ## It's a bash array. You can specify more than one email address ## default is: targets=('root') #targets=('root' 'root@localhost.42') mailboot.in +13 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,17 @@ VERSION=@VERSION@ # default settings targets=('root') # source config file if exists [[ -r @sysconfdir@/mailboot.conf ]] && source @sysconfdir@/mailboot.conf usage() { echo "usage: ${0##*/} [options]" >&2 echo 'options:' >&2 echo " -s: send the mail" >&2 echo " -p: print the mail to stdout" >&2 echo " -s: send mail" >&2 echo " -p: print mail to stdout" >&2 echo " -h: this help" >&2 echo " -v: print mailboot version" >&2 exit ${1:-1} Loading @@ -34,7 +40,10 @@ print_version() { print_mail() { source /etc/os-release echo "To: \"$(getent passwd root|cut -f5 -d:)\" <root>" printf 'To: ' for target in "${targets[@]}";do printf "\"$target\" " done | sed -e 's/ $/\n/' -e 's/ /, /g' echo "Subject: [MAILBOOT] $(hostname -f)" echo echo "Operating system is $NAME" Loading @@ -49,9 +58,8 @@ print_mail() { last -5 -FRwx|head -n 5 } send_mail() { print_mail | sed 's/$/\r/' | sendmail root print_mail | sed 's/$/\r/' | sendmail "${targets[@]}" } while getopts 'psvh' opt; do Loading Loading
Makefile.am +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ bin_SCRIPTS = mailboot noinst_SCRIPTS = PKGBUILD dist_doc_DATA = README.rst COPYRIGHT LICENSE AUTHORS systemdunit_DATA = mailboot.service dist_sysconf_DATA = mailboot.conf mailboot: mailboot.in $(do_substitution) < $(srcdir)/$< > $@ Loading @@ -34,6 +35,7 @@ PKGBUILD: PKGBUILD.in do_substitution = $(SED) \ -e 's,[@]bindir[@],$(bindir),g' \ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \ -e 's,[@]VERSION[@],$(VERSION),g' check: mailboot Loading
PKGBUILD.in +2 −1 Original line number Diff line number Diff line Loading @@ -8,12 +8,13 @@ arch=('any') url='https://github.com/seblu/mailboot' license=('GPL') depends=('bash' 'systemd' 'sed') backup=('etc/mailboot.conf') source=("$pkgname-$pkgver.tar.xz") md5sums=('SKIP') build() { cd $pkgname-$pkgver ./configure --prefix=/usr ./configure --prefix=/usr --sysconfdir=/etc make } Loading
mailboot.conf 0 → 100644 +7 −0 Original line number Diff line number Diff line ## config file for mailboot ## Specify mail destinations. Directly given to sendmail. ## Can be a local user or a mail@localhost.com ## It's a bash array. You can specify more than one email address ## default is: targets=('root') #targets=('root' 'root@localhost.42')
mailboot.in +13 −5 Original line number Diff line number Diff line Loading @@ -17,11 +17,17 @@ VERSION=@VERSION@ # default settings targets=('root') # source config file if exists [[ -r @sysconfdir@/mailboot.conf ]] && source @sysconfdir@/mailboot.conf usage() { echo "usage: ${0##*/} [options]" >&2 echo 'options:' >&2 echo " -s: send the mail" >&2 echo " -p: print the mail to stdout" >&2 echo " -s: send mail" >&2 echo " -p: print mail to stdout" >&2 echo " -h: this help" >&2 echo " -v: print mailboot version" >&2 exit ${1:-1} Loading @@ -34,7 +40,10 @@ print_version() { print_mail() { source /etc/os-release echo "To: \"$(getent passwd root|cut -f5 -d:)\" <root>" printf 'To: ' for target in "${targets[@]}";do printf "\"$target\" " done | sed -e 's/ $/\n/' -e 's/ /, /g' echo "Subject: [MAILBOOT] $(hostname -f)" echo echo "Operating system is $NAME" Loading @@ -49,9 +58,8 @@ print_mail() { last -5 -FRwx|head -n 5 } send_mail() { print_mail | sed 's/$/\r/' | sendmail root print_mail | sed 's/$/\r/' | sendmail "${targets[@]}" } while getopts 'psvh' opt; do Loading