#!/bin/sh # check one or more package lists from /var/log/packages to see if the # files listed there actually exist on the filesystem. # ROOT variable is respected, same as installpkg. # .new config files are checked for without their .new ending. # known issue: any file whose name has a colon in it, won't be checked. # exit status of this script will be 0 for OK, non-zero if one or # more file was missing. exitstatus=0 # package filenames are ASCII, this will speed things up slightly. LANG="C" LC_ALL="C" export LANG LC_ALL check_pkg() { if [ ! -e "$1" ]; then echo "$0: $1 not found" 1>&2 exitstatus=1 return fi grep -v -e ":" -e "^install" "$1" | sed 's,\.new$,,' > "$tmpfile" ( while read line; do [ -e "$ROOT"/"$line" ] || ( exitstatus=1 && echo "$1: missing $line" ) done ) < "$tmpfile" } if [ -z "$*" -o "$1" = "--help" ]; then cat <