Browse Source

Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.

OPENBSD_2_6
millert 25 years ago
parent
commit
2b37e10adf
1 changed files with 3 additions and 42 deletions
  1. +3
    -42
      src/etc/rc

+ 3
- 42
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.120 1999/10/07 05:11:19 deraadt Exp $
# $OpenBSD: rc,v 1.121 1999/10/11 20:09:53 millert Exp $
# System startup script run by init on autoboot
# or after single-user.
@ -328,47 +328,8 @@ if [ $? -eq 0 ]; then
rm -f $T
fi
# vi file recovery
vidir=/var/tmp/vi.recover
if [ ! -e $vidir ]; then
mkdir $vidir
chmod 1777 $vidir
elif [ -L $vidir ]; then
echo "Warning! $vidir is a symbolic link! (ignoring)"
elif [ ! -O $vidir ]; then
echo "Warning! $vidir is not owned by root! (ignoring)"
elif [ ! -d $vidir -a -e $vidir ]; then
echo "Warning! $vidir is not a directory! (ignoring)"
else
vibackup=$vidir/vi.*
for i in $vibackup; do
[ "$i" = "$vibackup" ] && break
# Unmodified vi editor backup files either have the
# execute bit set or are zero length. Delete them.
# Anything that is not a normal file gets deleted too.
if [ -x $i -o ! -s $i -o ! -f $i ]; then
rm $i
fi
done
virecovery=$vidir/recover.*
echo preserving editor files
for i in $virecovery; do
[ "$i" = "$virecovery" ] && break
# Delete any recovery files that are zero length,
# corrupted, # or that have no corresponding backup
# file. Else send mail to the user.
if [ -f $i ]; then
recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i`
if [ -n "$recfile" -a -s "$recfile" ]; then
sendmail -t < $i
else
rm $i
fi
else
rm $i
fi
done
if [ -x /usr/libexec/vi.recover ]; then
echo 'preserving editor files'; /usr/libexec/vi.recover
fi
if [ -f /var/account/acct ]; then


Loading…
Cancel
Save