Tweaks to syncTemplate.sh

This commit is contained in:
Nathaniel Landau
2015-01-02 22:27:03 -05:00
parent cebcd99cff
commit 41e524870d
3 changed files with 189 additions and 143 deletions

View File

@@ -8,6 +8,17 @@
#
# ##################################################
# scriptPath
# ------------------------------------------------------
# This function will populate the variable SOURCEPATH with the
# full path of the script being run.
# Note: The function must be run within the script before using
# the variable
# ------------------------------------------------------
function scriptPath() {
SCRIPTPATH=$( cd "$( dirname "$0" )" && pwd )
}
# readFile
# ------------------------------------------------------
# Function to read a line from a file.

View File

@@ -14,7 +14,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPTPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCEPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Write the list of utility files to be sourced
FILES="
@@ -26,8 +26,8 @@ FILES="
# Source the Utility Files
for file in $FILES
do
if [ -f "$SCRIPTPATH/$file" ]; then
source "$SCRIPTPATH/$file"
if [ -f "$SOURCEPATH/$file" ]; then
source "$SOURCEPATH/$file"
else
e_error "$file does not exist. Exiting"
Exit 1