diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-10-11 20:09:54 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-10-11 20:09:54 +0000 |
commit | 84bfe032bab05c88e7898f0e487c3a6b5d85e8d0 (patch) | |
tree | 88afde9e213bfb3517384e68d14c1171e02e1051 /etc/rc | |
parent | 969db8ced6f813b2676bf309520c28e3065aef8b (diff) |
Run /usr/libexec/vi.recover (now a perl script) to preserve vi backup files.
Diffstat (limited to 'etc/rc')
-rw-r--r-- | etc/rc | 45 |
1 files changed, 3 insertions, 42 deletions
@@ -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 |