#!/bin/bash
#
# Check the filesystem against the aide database and update it (ie each change is reported only once)
#

SELF=$(readlink -f $0)
DIR=$(dirname ${SELF})


if [ ! -f /var/lib/aide/aide.db.gz ]; then
    # If this is the first run, we just want to populate the database and not report, since we have nothing to compare to
    aide --init && mv -f /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
else
    aide --update 2>&1 | grep -vE '^getxattr failed for .*?:No such file or directory$'
fi
