Add a chunk of code to check the installed pkgs list by making a list

of all installed pkgs and their +CONTENTS and +REQUIRED_BY files (if
they have one) and handling this file along with all the other
CHANGELIST stuff.

Greg Woods gets points for coming up with the idea.

Luke Mewburn asked me to do it, and provided lots of criticism along
the way.
This commit is contained in:
atatat 2001-10-01 02:21:20 +00:00
parent e28d27cc0d
commit 9202500182
2 changed files with 22 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: security.conf,v 1.6 2001/04/04 03:17:20 atatat Exp $
# $NetBSD: security.conf,v 1.7 2001/10/01 02:21:20 atatat Exp $
#
# /etc/defaults/security.conf --
# default configuration of /etc/security.conf
@ -21,10 +21,12 @@ check_nfs=YES
check_devices=YES
check_mtree=YES
check_disklabels=YES
check_pkgs=YES
check_changelist=YES
backup_dir=/var/backups
backup_uses_rcs=YES
pkg_dbdir=/var/db/pkg
max_loginlen=8
max_grouplen=8

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $NetBSD: security,v 1.61 2001/09/24 03:19:43 lukem Exp $
# $NetBSD: security,v 1.62 2001/10/01 02:21:20 atatat Exp $
# from: @(#)security 8.1 (Berkeley) 6/9/93
#
@ -44,9 +44,12 @@ MPBYPATH=secure5.$$
LIST=secure6.$$
OUTPUT=secure7.$$
LABELS=secure8.$$
PKGS=secure9.$$
# Handle backup_dir not being set in .conf file
backup_dir=${backup_dir:-/var/backups}
CHANGELIST=""
pkg_dbdir=${pkg_dbdir:-/var/db/pkg}
MP=/etc/master.passwd
@ -645,8 +648,6 @@ if checkyesno check_mtree; then
fi
fi
CHANGELIST=""
# Backup disklabels of available disks
#
if checkyesno check_disklabels; then
@ -665,7 +666,21 @@ if checkyesno check_disklabels; then
ls -1d $backup_dir/disklabel.* 2>/dev/null |
egrep -v '\.(backup|current)(,v)?$' >> $LABELS
sort -u -o $LABELS $LABELS
CHANGELIST=$LABELS
CHANGELIST="$LABELS $CHANGELIST"
fi
# Check for changes in the list of installed pkgs
#
if checkyesno check_pkgs && [ -d $pkg_dbdir ]; then
pkgs=$backup_dir/pkgs
( cd $pkg_dbdir
pkg_info | sort
echo ""
find . \( -name +REQUIRED_BY -o -name +CONTENTS \) -print0 |
xargs -0 ls -l | sort -t. +1 | sed -e 's, \./, ,'
) > $pkgs
echo $pkgs > $PKGS
CHANGELIST="$PKGS $CHANGELIST"
fi
# List of files that get backed up and checked for any modifications. Each