A script to check integrity of installed packages

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Aug 7 01:15:00 GMT 2003


Hi,

For some reason some commands (like "man" and "enscript") stopped working
for me.  After investigating, it turned out that parts of my /usr/share
tree got lost, and I wanted to find out exactly what got zapped without
having to reinstall everything on my system.  I used the attached script
to look through the installed package database and check my system against
it.  Hopefully, someone will find it useful.

It would have also been nice if something like this were distributed
either with setup or as a separate package, or if this functionality were
incorporated into cygcheck.  If the latter sounds like a better option, I
could rewrite the script in C++ and submit the appropriate patch to
cygcheck.

Comments and feedback welcome.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton
-------------- next part --------------
#!/bin/bash
#
# Copyright (c) 2003, Igor Pechtchanski
#
#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
#
#     A copy of the GNU General Public License can be found at
#     http://www.gnu.org/
#
# Written by Igor Pechtchanski <pechtcha@cs.nyu.edu>
#
# This script will check for missing files and directories from packages
# installed via setup.  Files created by postinstall scripts will not be
# checked.

cd /etc/setup
cat installed.db | while read line; do
  number=${line##* }
  if [ $number == 0 ]; then
  package=${line%% *}
  listfile=$package.lst.gz
  archive=${line% *}
  archive=${archive#* }
  echo ================\> $package $archive
  zcat $listfile | while read file; do
    case $file in
      */)                       # directories
          test -d /$file || \
          echo "Missing directory: /$file from package $package!"
          ;;
      etc/postinstall/*)        # postinstall scripts
          test -f /$file || \
          test -f /$file.done || \
          echo "Missing postinstall script: /$file.done from package $package!"
          ;;
      *)                        # regular files
          test -e /$file || \
          echo "Missing file: /$file from package $package!"
          ;;
    esac
  done
  fi
done



More information about the Cygwin-apps mailing list