Extract common functions into a separate file

This is the start of an effort to organize devstack's code
to better document the requirements for configuring the individual
components.

Change-Id: I3476b76b9d1f9ee63687fb9898a98729118cbd84
diff --git a/tools/copy_dev_environment_to_uec.sh b/tools/copy_dev_environment_to_uec.sh
index c949b32..d5687dc 100755
--- a/tools/copy_dev_environment_to_uec.sh
+++ b/tools/copy_dev_environment_to_uec.sh
@@ -8,7 +8,10 @@
 
 # Keep track of the current directory
 TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=`cd $TOOLS_DIR/..; pwd`
+TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
+
+# Import common functions
+. $TOP_DIR/functions
 
 # Change dir to top of devstack
 cd $TOP_DIR
@@ -47,13 +50,6 @@
 ( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \
     > $STAGING_DIR/etc/sudoers.d/50_stack_sh )
 
-# Gracefully cp only if source file/dir exists
-function cp_it {
-    if [ -e $1 ] || [ -d $1 ]; then
-        cp -pRL $1 $2
-    fi
-}
-
 # Copy over your ssh keys and env if desired
 cp_it ~/.ssh $STAGING_DIR/$DEST/.ssh
 cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/$DEST/.ssh/authorized_keys