3 # a script that handles synchronization of important assets from the MAJOR_ARCHIVE_SOURCES
4 # and the SOURCECODE_HIERARCHY_LIST onto a backup drive of some sort. it will only copy folders
5 # if there is a target folder of the appropriate name already on the backup medium.
7 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
9 # given a location in the filesystem, we will go to that location and attempt to
10 # update any revision control repositories stored there to the latest versions.
11 function update_source_folders()
15 if [ ! -d "$folder" ]; then
16 echo "The folder '$folder' does not exist, so skipping repository update there."
19 echo getting latest codes in $folder...
22 echo Changing to the folder $folder failed.
25 bash "$FEISTY_MEOW_SCRIPTS/rev_control/rcheckin.sh"
27 echo Checking out the latest codes has failed somehow for $folder.
34 # this attempts to copy all the contents in a folder called "from" into a folder
35 # called "to". it's a failure for the "from" folder to not exist, but the "to"
36 # is allowed to not exist (in which case we don't try to synch to it).
37 function synch_directory_to_target()
39 local from="$1"; shift
44 if [ ! -d "$from" ]; then
45 echo "skipping synch on missing source directory: ${from}"
48 if [ ! -d "$to" ]; then
49 echo "skipping synch into non-existent target directory $to"
53 echo "synching from $from into $to"
54 netcp "$from"/* "$to"/
56 echo "The synchronization of $from into $to has failed."
61 # the uber controller method that does the "hard" work of updating.
62 # any items from the MAJOR_ARCHIVE_SOURCES that are on the target will be
63 # updated. any items found on the target matching the members of the
64 # SOURCECODE_HIERARCHY_LIST will be treated as code hierarchies and updated.
65 function update_archive_drive()
67 local target_folder="$1"; shift # where we're backing up to.
68 local currdir # loop variable.
72 echo Target drive currently has...
75 echo "The target location '$target_folder' is not mounted currently, so cannot be updated."
79 # synch all our targets.
80 for currdir in $MAJOR_ARCHIVE_SOURCES; do
81 synch_directory_to_target "$currdir" "$target_folder/$(basename $currdir)"/
86 # update source code if present.
87 echo getting latest fred repositories...
88 pushd "$target_folder"
89 for currdir in $SOURCECODE_HIERARCHY_LIST; do
90 update_source_folders $currdir
95 echo successfully updated all expected portions of the target drive at:
96 echo " $target_folder"