pax_global_header 0000666 0000000 0000000 00000000064 12177043350 0014514 g ustar 00root root 0000000 0000000 52 comment=706c1871663567259629655448188c39ab8df193
mailboot-v2/ 0000775 0000000 0000000 00000000000 12177043350 0013213 5 ustar 00root root 0000000 0000000 mailboot-v2/.gitignore 0000664 0000000 0000000 00000000067 12177043350 0015206 0 ustar 00root root 0000000 0000000 .*.swp
*~
TODO
Makefile
Makefile.in
*.tar.xz
configure
mailboot-v2/AUTHORS 0000664 0000000 0000000 00000000030 12177043350 0014254 0 ustar 00root root 0000000 0000000 * Sébastien LUTTRINGER
mailboot-v2/COPYRIGHT 0000664 0000000 0000000 00000000050 12177043350 0014501 0 ustar 00root root 0000000 0000000 Copyright © 2013 Sébastien Luttringer
mailboot-v2/LICENSE 0000664 0000000 0000000 00000016743 12177043350 0014233 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
mailboot-v2/Makefile.am 0000664 0000000 0000000 00000002727 12177043350 0015257 0 ustar 00root root 0000000 0000000 # This file is part of MAILBOOT.
#
# MAILBOOT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MAILBOOT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with MAILBOOT. If not, see .
EXTRA_DIST = mailboot.in mailboot.service.in PKGBUILD.in
CLEANFILES = mailboot mailboot.service PKGBUILD
bin_SCRIPTS = mailboot
noinst_SCRIPTS = PKGBUILD
dist_doc_DATA = README.rst COPYRIGHT LICENSE AUTHORS
systemdunit_DATA = mailboot.service
dist_sysconf_DATA = mailboot.conf
do_substitution = $(SED) \
-e 's,[@]bindir[@],$(bindir),g' \
-e 's,[@]sysconfdir[@],$(sysconfdir),g' \
-e 's,[@]VERSION[@],$(VERSION),g'
mailboot: mailboot.in
$(do_substitution) < $(srcdir)/$< > $@
chmod +x $@
mailboot.service: mailboot.service.in
$(do_substitution) < $(srcdir)/$< > $@
# version is defined in configure, so PKGBUILD depends of configure
PKGBUILD: PKGBUILD.in configure
$(do_substitution) < $(srcdir)/$< > $@
check: mailboot
./mailboot -p
arch: PKGBUILD dist
makepkg -f
dist-hook:
rm -f $(distdir)/TODO
mailboot-v2/PKGBUILD.in 0000664 0000000 0000000 00000000756 12177043350 0014754 0 ustar 00root root 0000000 0000000 # Maintainer: Sébastien Luttringer
pkgname=mailboot
pkgver=@VERSION@
pkgrel=1
pkgdesc='Send an email when your computer boot'
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 --sysconfdir=/etc
make
}
package() {
cd $pkgname-$pkgver
make install DESTDIR="$pkgdir"
}
# vim:set ts=2 sw=2 et:
mailboot-v2/README.rst 0000664 0000000 0000000 00000004304 12177043350 0014703 0 ustar 00root root 0000000 0000000 ========
MAILBOOT
========
INTRODUCTION
============
Once upon a time, a computer reboot. Again. And again. And again.
Whereas a lot of computers reboot and we don't care, few should not reboot
without notifying someone.
**MAILBOOT** is a small program (and systemd service unit) used to send an email
when a computer boot (or reboot), providing useful informations and setupable
in less than 1min.
Why do not use cron?
--------------------
I started with a cron line. But after workarounded the basic missing feature of
customizing the mail subject in my cron daemon (fcron) in using mail command,
I was borred by being able to send interesting information in one sh line.
So I decided to find another solution. Here we are.
What you cannot do with mailboot?
-----------------------------------
The coffee.
HOW TO USE IT
=============
To print the mail::
$ mailboot -p
To send the mail::
$ mailboot -s
To send the mail at reboot::
$ systemctl enable mailboot.service
.. caution::
**A working mail forwarder is expected on your system.
The sendmail command must be functionnal!**
DEPENDENCIES
============
- Bash [#]_
- Systemd [#]_
- sysvinit-tools
- Sed
INSTALL
=======
Using autotools
---------------
::
$ ./autogen.sh
$ ./configure
$ make install
$ /usr/local/bin/mailboot
Using Archlinux packages
------------------------
An Archlinux package is provided with the source tree and you can create your
package with the following commands:
::
$ ./autogen.sh
$ ./configure
$ make
$ makepkg
$ pacman -U mailboot-*-1-any.pkg.tar.xz
You can find the last version of mailboot into AUR [#]_.
RELEASES
========
You can download **MAILBOOT** release tarballs on my ftp: [#]_.
SOURCES
=======
**MAILBOOT** sources are available on github [#]_.
LICENSE
=======
**MAILBOOT** is licensied under the term of GPL v2 [#]_.
AUTHOR
======
**MAILBOOT** was started by Sébastien Luttringer in July 2013.
LINKS
=====
.. [#] http://www.gnu.org/software/bash/
.. [#] http://www.freedesktop.org/wiki/Software/systemd/
.. [#] http://ftp.seblu.net/softs/mailboot/
.. [#] https://aur.archlinux.org/packages/mailboot/
.. [#] https://github.com/seblu/mailboot/
.. [#] http://www.gnu.org/licenses/gpl-2.0.html
mailboot-v2/autogen.sh 0000775 0000000 0000000 00000001333 12177043350 0015214 0 ustar 00root root 0000000 0000000 #/bin/bash -x
# This file is part of MAILBOOT.
#
# MAILBOOT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MAILBOOT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with MAILBOOT. If not, see .
autoreconf --force -v --install "$@"
mailboot-v2/configure.ac 0000664 0000000 0000000 00000002071 12177043350 0015501 0 ustar 00root root 0000000 0000000 # This file is part of MAILBOOT.
#
# MAILBOOT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MAILBOOT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with MAILBOOT. If not, see .
AC_INIT([mailboot], [2], [seblu@seblu.net])
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip])
AC_CONFIG_FILES([
Makefile
])
AC_ARG_WITH([systemdunitdir],
AS_HELP_STRING([--with-systemdunitdir=DIR], [Systemd unit directory]),
[], [with_systemdunitdir=${libdir}/systemd/system]
)
AC_SUBST([systemdunitdir], [$with_systemdunitdir])
AC_CHECK_PROG([BASH], [bash], true, false)
AC_PROG_SED
AC_OUTPUT
mailboot-v2/mailboot.conf 0000664 0000000 0000000 00000000416 12177043350 0015671 0 ustar 00root root 0000000 0000000 ## 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-v2/mailboot.in 0000664 0000000 0000000 00000003665 12177043350 0015363 0 ustar 00root root 0000000 0000000 #!/bin/bash
# This file is part of MAILBOOT.
#
# MAILBOOT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MAILBOOT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with MAILBOOT. If not, see .
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 mail" >&2
echo " -p: print mail to stdout" >&2
echo " -h: this help" >&2
echo " -v: print mailboot version" >&2
exit ${1:-1}
}
print_version() {
echo $VERSION
}
print_mail() {
source /etc/os-release
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"
echo "Kernel is $(uname -s) $(uname -r) on $(uname -m)"
echo
echo "Current time is $(date -R)"
echo "System is up since $(date -d "$(uptime -s)" -R)"
echo
echo "$(systemd-analyze)"
echo
echo 'Last:'
last -5 -FRwx|head -n 5
}
send_mail() {
print_mail | sed 's/$/\r/' | sendmail "${targets[@]}"
}
while getopts 'psvh' opt; do
case $opt in
s) send_mail;;
p) print_mail;;
v) print_version;;
h) usage 0;;
*) usage;;
esac
done
(( $OPTIND != 1 )) || usage
# vim:set ts=4 sw=4 ft=sh et:
mailboot-v2/mailboot.service.in 0000664 0000000 0000000 00000000236 12177043350 0017011 0 ustar 00root root 0000000 0000000 [Unit]
Description=Send report mail at boot
After=network.target
[Service]
Type=oneshot
ExecStart=@bindir@/mailboot -s
[Install]
WantedBy=multi-user.target