Cleaned up directory naming and implemented environment variable
override of base directory via $CFBASE.
1 parent 6886256 commit 7ab1ae774dd2c140e21f27ce90a6a4b28a749535
@tundra tundra authored on 12 Feb 2013
Showing 1 changed file
View
25
tconfigfiles
#!/bin/sh
# tconfigfiles - Manage Configuration Files
# Copyright (c) 2007-2013 TundraWare Inc., Des Plaines, IL USA
# All Rights Reserved
# $Id: tconfigfiles,v 1.114 2013/02/13 03:37:25 tundra Exp $
# $Id: tconfigfiles,v 1.115 2013/02/13 03:50:15 tundra Exp $
 
CFBASE=${CFBASE:-$HOME/sysgen} # The directory that holds everything below
ARCHIVES=archives # Where archives go
TREENAME=tree # Where tree of individual files lives
 
ARCHIVES=archives
CFTREE=tree
BASE="$HOME/sysgen/$CFTREE"
TREE="$CFBASE/$TREENAME"
CMD=`basename $0`
 
case $CMD
in
 
 
"cfarchive") # Make archival copy of current tree
timestamp=`date "+%Y-%m-%d-%H%M%S"`
cd $BASE/../
cd $CFBASE
mkdir -p $ARCHIVES
MACHNAME=`hostname -f`
archdir=$MACHNAME-$CFTREE-$timestamp
cp -pvR $CFTREE $archdir
mkdir -p $ARCHIVES
archdir=$MACHNAME-$TREENAME-$timestamp
cp -pvR $TREENAME $archdir
tar -czvf $ARCHIVES/$archdir.tar.gz $archdir
rm -rf $archdir
;;
 
 
"cfbku") # Backup configuration files to tree
for f in $*
do
bkudir=$BASE`pwd -P`/
bkudir=$TREE`pwd -P`/
mkdir -p $bkudir
cp -pvR $f $bkudir
done
;;
 
"cfinstall") # Install configuration files from tree
for f in $*
do
targetdir=`pwd -P | sed s?$BASE??`
targetdir=`pwd -P | sed s?$TREE??`
cp -pvR $f $targetdir
done
;;