add tests and move scripts

This commit is contained in:
Simon Vieille 2019-06-12 13:12:57 +02:00
parent c006bbdd30
commit a555aadc33
Signed by: deblan
GPG Key ID: 03383D15A1D31745
4 changed files with 10 additions and 35 deletions

View File

@ -11,13 +11,13 @@ if ! which envsubst 2>/dev/null >/dev/null; then
fi fi
if ! which base64 2>/dev/null >/dev/null; then if ! which base64 2>/dev/null >/dev/null; then
printf "Le programme \`envsubst\` est nécessaire. Installer \`coreutils\`.\n" printf "Le programme \`base64\` est nécessaire. Installer \`coreutils\`.\n"
exit 1 exit 1
fi fi
if ! which smartcl 2>/dev/null >/dev/null; then if test -n "$SMART_DEVICES" && ! which smartcl 2>/dev/null >/dev/null; then
printf "Le programme \`envsubst\` est nécessaire. Installer \`smartmontools\`.\n" printf "Le programme \`smartcl\` est nécessaire. Installer \`smartmontools\`.\n"
exit 1 exit 1
fi fi

10
report
View File

@ -26,20 +26,24 @@ REPORT="$(
./scripts/system ./scripts/system
./scripts/mount ./scripts/mount
./scripts/df ./scripts/df
./scripts/smart
if [ -n "$SMART_DEVICES" ]; then
./scripts/smart
fi
./scripts/footer ./scripts/footer
)" )"
if [ -n "$HTML_OUTPUT" ]; then if [ -n "$HTML_OUTPUT" ]; then
export REPORT export REPORT
./scripts/html ./generators/html
fi fi
if [ -n "$EMAIL_RECIPIENT" ]; then if [ -n "$EMAIL_RECIPIENT" ]; then
export REPORT export REPORT
./scripts/email ./generators/email
fi fi
./hooks/on-finish ./hooks/on-finish

View File

@ -1,22 +0,0 @@
#!/bin/sh
. ./helpers/template
export BOUNDARY="-$(date | md5sum | cut -d ' ' -f 1)"
(
render_template mail
if [ -n "$MUNIN_DIRECTORY" -a -d "$MUNIN_DIRECTORY" ]; then
cd "$MUNIN_DIRECTORY"
for file in *day.png; do
export file
export base64="$(base64 "$file")"
render_template mail-png-attachment
done
fi
printf "\n--%s--\n" "$BOUNDARY"
)| sendmail "$EMAIL_RECIPIENT"

View File

@ -1,7 +0,0 @@
#!/bin/sh
. ./helpers/template
export content="$REPORT"
render_template plain > "$HTML_OUTPUT"