Newer
Older
tconfigfiles / tconfigfiles
@root root on 4 Aug 2007 1006 bytes Minor cosmetic changes.
#!/bin/sh
# tconfigfiles - Manage Configuration Files
# Copyright (c) 2007 TundraWare Inc., Des Plaines, IL USA
# All Rights Reserved
# $Id: tconfigfiles,v 1.106 2007/08/04 07:28:31 root Exp $


ARCHIVES=configarchives
CFTREE=configtree
SBASE="\/root\/sysgen\/$CFTREE"
BASE=`echo $SBASE | sed s/\\\\\\\\//g`
CMD=`basename $0`


case $CMD
in


  "cfarchive")         # Make archival copy of current tree
    timestamp=`date  "+%Y-%m-%d-%H:%M:%S"`
    cd $BASE/../
    archdir=$CFTREE-$timestamp
    cp -pvR $CFTREE $archdir
    tar -czvf $ARCHIVES/$archdir.tar.gz $archdir
    rm -rf $archdir
  ;;


  "cfbku")             # Backup configuration files to tree
    for f in $*
    do
      bkudir=$BASE`pwd`/
      mkdir -p $bkudir
      cp -pvR $f $bkudir
    done
  ;;


  "cfinstall")         # Install configuration files from tree
    for f in $*
    do
      targetdir=`pwd | sed s/$SBASE//`
      cp -pvR $f $targetdir
    done
  ;;


  *)
    echo "Unknown Command ===>  $CMD"
    exit 1
  ;;


esac