home *** CD-ROM | disk | FTP | other *** search
- :
- # ------------------------------------------------------------------
- # Title : map.daily -- automatically install new maps
- # Usage : map.daily [ -v ] [ -V ]
- # Options : -v : Verbose mode, show up "no op" invocation
- # -V : Very Verbose Mode
- # Version : Sat, 26-May-90 / 11:45 / (root@artcom0)
- # Remarks : You may create a directory /usr/lib/uucp/oldmaps
- # with some numerical named subdirectories. e.g.
- # /usr/lib/uucp/oldmaps/0
- # /usr/lib/uucp/oldmaps/1 ...
- # Older maps will be preserved there.
- # These directories should be owned by 'news' and
- # should also have write-Permissions, if You don't
- # want to run this script here under 'root' !
- # If you don't trust new maps, You may also choose
- # the '-V' option, and You will get a diff mail,
- # whenever there are new maps arrived !
- # ------------------------------------------------------------------
- if [ "$1" = "-v" ]
- then VERBOSE=TRUE
- shift
- else VERBOSE=
- fi
- if [ "$1" = "-V" ]
- then VERBOSE=Talkative
- shift
- fi
- MAPDIR=/usr/lib/uucp/maps
- OLDMAPS=/usr/lib/uucp/oldmaps
- cd $MAPDIR/work
- # --- Do the installation
- NEWMAPS=
- for i in * ; do
- if [ "$i" = "*" ]
- then if [ "$VERBOSE" ]
- then echo "No new maps arrived !"
- fi
- exit 0
- fi
- # -- preserve old maps
- for olddirnum in 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ; do
- OLDMAPDIR=$OLDMAPS/$olddirnum
- if [ -d $OLDMAPDIR ]
- then if [ $olddirnum -gt 0 ]
- then prevdirnum=`expr $olddirnum - 1`
- PREVDIR=$OLDMAPS/$prevdirnum
- else PREVDIR=$MAPDIR
- fi
- if [ -f $PREVDIR/$i ]
- then mv $PREVDIR/$i $OLDMAPDIR/$i
- fi
- fi
- done
- mv $i $MAPDIR
- NEWMAPS="$NEWMAPS $i"
- done
- # -- mail significant map changes as diff to the postmaster :
- if [ "$VERBOSE" = "Talkative" ] && [ -d $OLDMAPS/0 ]
- then if [ -x /usr/local/bin/gdiff ]
- then /usr/local/bin/gdiff -r -c $OLDMAPS/0 $MAPDIR
- else cd $MAPDIR
- for i in $NEWMAPS ; do
- if [ -r $OLDMAPS/0/$i ]
- then echo "--- $i Differences: ---"
- diff $OLDMAPS/0/$i $i
- else echo "--- $i is a new map file ! ---"
- fi
- done
- fi | mail -s "Map Changes" postmaster
- fi
- # -- regenerate the paths database :
- cd $MAPDIR
- ./mkpaths
-