diff --git a/tconfigfiles b/tconfigfiles index c0aa5cc..1dfa00b 100755 --- a/tconfigfiles +++ b/tconfigfiles @@ -2,15 +2,27 @@ # tconfigfiles - Manage Configuration Files # Copyright (c) 2007-2013 TundraWare Inc., Des Plaines, IL USA # All Rights Reserved -# $Id: tconfigfiles,v 1.115 2013/02/13 03:50:15 tundra Exp $ +# $Id: tconfigfiles,v 1.116 2013/02/13 04:34:08 tundra Exp $ + +# Where things live CFBASE=${CFBASE:-$HOME/sysgen} # The directory that holds everything below + # Can be overridden with $CFBASE env var + ARCHIVES=archives # Where archives go -TREENAME=tree # Where tree of individual files lives +FILES=tree # Where tree of individual files lives -TREE="$CFBASE/$TREENAME" +ARCHIVEDIR="$CFBASE/$ARCHIVES" +FILEDIR="$CFBASE/$FILES" + +# Make sure the container directories exist + +mkdir -p $ARCHIVEDIR +mkdir -p $FILEDIR + +# The name used to invoke the program tells us what to do + CMD=`basename $0` - case $CMD in @@ -18,10 +30,9 @@ "cfarchive") # Make archival copy of current tree timestamp=`date "+%Y-%m-%d-%H%M%S"` cd $CFBASE - mkdir -p $ARCHIVES MACHNAME=`hostname -f` - archdir=$MACHNAME-$TREENAME-$timestamp - cp -pvR $TREENAME $archdir + archdir=$MACHNAME-$FILES-$timestamp + cp -pvR $FILES $archdir tar -czvf $ARCHIVES/$archdir.tar.gz $archdir rm -rf $archdir ;; @@ -30,7 +41,8 @@ "cfbku") # Backup configuration files to tree for f in $* do - bkudir=$TREE`pwd -P`/ + abspath=`readlink -f $f` + bkudir=$FILEDIR`dirname $abspath`/ mkdir -p $bkudir cp -pvR $f $bkudir done @@ -40,7 +52,8 @@ "cfinstall") # Install configuration files from tree for f in $* do - targetdir=`pwd -P | sed s?$TREE??` + abspath=`readlink -f $f` + targetdir=`echo $abspath | sed s?$FILEDIR??` cp -pvR $f $targetdir done ;;