#!/bin/bash getyn() { while echo -n "$* (y/n) ">&2 do read yn rest case $yn in [yY]) return 0 ;; [nN]) return 1 ;; *) echo "Please answer y or n" >&2 ;; esac done } sudo aide -C 2>&1 | grep 'Looks okay!' - if [ $? == 0 ] ; then sudo emerge sync sudo emerge -auvD --tree world sudo dispatch-conf sudo aide -i sudo moveaidedb else echo "Aide Database Changed!" echo "Display curruption:" sudo aide -C if (getyn "Do you want to ignore these changes implicit?") ; then sudo emerge sync sudo emerge -auvD --tree world sudo dispatch-conf sudo aide -i sudo moveaidedb else echo "exiting ..." exit 1 fi fi