Signed-off-by: Jonathan Frazier <[email protected]>
---
 contrib/pacdiff.sh.in | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index 6b5edb9..349f6b9 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -28,6 +28,7 @@ diffsearchpath=${DIFFSEARCHPATH:-/etc}
 USE_COLOR='y'
 declare -a oldsaves
 declare -i FIND=0 LOCATE=0 PACDB=0 OUTPUTONLY=0
+declare -i UPDATEDB=0
 
 m4_include(../scripts/library/output_format.sh)
 
@@ -122,6 +123,20 @@ case $(( FIND+LOCATE+PACDB )) in
                usage; exit 1;;
 esac
 
+if (( LOCATE )) && (( ! OUTPUTONLY )); then
+       ask "Run updatedb? [y/n] "
+       while read c; do
+               case $c in
+                       Y|y) UPDATEDB=1; break;; #&& (error "updatedb failed"; 
exit 1);;
+                       N|n) break;;
+                       *) ask "Invalid answer. Try again: [y/n] "; continue ;;
+               esac
+       done
+fi
+if (( UPDATEDB )); then
+       updatedb || error "updatedb failed"
+fi
+
 if (( PACDB )); then
        if [[ ! -r @sysconfdir@/pacman.conf ]]; then
                error "unable to read @sysconfdir@/pacman.conf"
-- 
1.8.3.2


Reply via email to