summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1997-10-08 16:13:44 +0000
committermycroft <mycroft@NetBSD.org>1997-10-08 16:13:44 +0000
commitdae4e5df8271dcc2cf6b60a58bb93d5a38c8e72b (patch)
treeb64bebfede03513d070556b097f0060f864458a2
parentfc752db7e80139fc23990cb72ec0522b3ef689bf (diff)
Deal with files in the changelist that are added or removed.
* When a file is removed, move its .current file to .backup. * When a file is added, create its .current file. * In either case, send a diff against /dev/null. Mostly from Jim Bernard in PR 4183, with the removal case fixed.
-rw-r--r--etc/security18
1 files changed, 13 insertions, 5 deletions
diff --git a/etc/security b/etc/security
index 4c345c996b1..6c51b9e80aa 100644
--- a/etc/security
+++ b/etc/security
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $NetBSD: security,v 1.29 1997/09/23 14:36:56 lukem Exp $
+# $NetBSD: security,v 1.30 1997/10/08 16:13:44 mycroft Exp $
# from: @(#)security 8.1 (Berkeley) 6/9/93
#
@@ -601,20 +601,28 @@ if [ "$check_changelist" = YES ] && [ -s /etc/changelist ] ; then
for file in `egrep -v "^#|$MP" /etc/changelist`; do
CUR=/var/backups/`basename $file`.current
BACK=/var/backups/`basename $file`.backup
- if [ -s $file ]; then
- if [ -s $CUR ] ; then
+ if [ -f $file ]; then
+ if [ -f $CUR ] ; then
diff $CUR $file > $OUTPUT
if [ -s $OUTPUT ] ; then
printf "\n======\n%s diffs (OLD < > NEW)\n======\n" $file
cat $OUTPUT
- cp -p $CUR $BACK
+ mv -f $CUR $BACK
cp -p $file $CUR
- chown root.wheel $CUR $BACK
+ chown root.wheel $CUR
fi
else
+ printf "\n======\n%s added\n======\n" $file
+ diff /dev/null $file
cp -p $file $CUR
chown root.wheel $CUR
fi
+ else
+ if [ -f $CUR ]; then
+ printf "\n======\n%s removed\n======\n" $file
+ diff $CUR /dev/null
+ mv -f $CUR $BACK
+ fi
fi
done
fi