Subject: bin/231: generalisation of /var/backups code in /etc/daily
To: None <gnats-admin>
From: Bob Kemp <rsk@allegory.demon.co.uk>
List: netbsd-bugs
Date: 04/22/1994 16:20:03
>Number:         231
>Category:       bin
>Synopsis:       generalisation of /var/backups code in /etc/daily
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 22 16:20:02 1994
>Originator:     Bob Kemp
>Organization:
	Home PC
>Release:        -current 05Mar94
>Environment:
	
System: NetBSD allegory 0.9a ALLEGORY#0 i386


>Description:

	I find /var/backups very handy and used to add more test/copy
	lines for local files to /etc/daily but had to do it again
	after every upgrade.  This made me think that it would be
	handy to generalise the code in /etc/daily.  Below is a
	fairly simple shell script to do this.

	Please replace the code in /etc/daily with that below.  The new
	code is about 100 bytes larger but saves files with their
	full pathname.

>How-To-Repeat:
>Fix:

#!/bin/sh

bak=/var/backups

files="
	/usr/X386/lib/X11/Xconfig
	/etc/master.passwd
	/etc/Distfile
	/etc/hosts
	/etc/group
	/etc/aliases
	/etc/phones
	/etc/remote

	/usr/local/news/active 
	/usr/allegory/lib/slurp/slurp.sys 
	/usr/allegory/lib/slip/demon 
	/usr/allegory/lib/slip/compserv.login 
	/usr/allegory/lib/kermit/phones 
	/usr/allegory/lib/Phone-log 
	/usr/allegory/bin/mkbackup 
	/usr/allegory/bin/local 
"

for f in $files; do
	save=`echo $f | sed -e s,/,@,g `
	printf '%-38s' $f
	if [ -f $f ]; then
		if cmp -s $f $bak/$save; then
			printf ' unchanged'
		else
			printf ' saving ... '
			if [ -f $bak/$save ]; then
				save2=`echo $f | sed -e s,/,^,g `
				mv $bak/$save $bak/$save2
			fi
			cp -p $f $bak/$save
			printf 'done.'
		fi
	else
		printf '*** nonexistent or not a regular file ***'
	fi
	echo ''
done

>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------