Merge branch 'release-2.140.93'
[feisty_meow.git] / scripts / archival / shared_updater_parts.sh
1 #!/bin/bash
2
3 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
4
5 # given a location in the filesystem, we will go to that location and attempt to
6 # update any revision control repositories stored there to the latest versions.
7 function update_source_folders()
8 {
9   folder="$1"; shift
10   if [ ! -d "$folder" ]; then
11     echo "The folder '$folder' does not exist, so skipping repository update there."
12     return;
13   fi
14   echo getting latest codes in $folder...
15   pushd "$folder"
16   if [ $? -ne 0 ]; then
17     echo Changing to the folder $folder failed.
18     exit 1
19   fi
20   bash "$FEISTY_MEOW_SCRIPTS/rev_control/rcheckin.sh"
21   if [ $? -ne 0 ]; then
22     echo Checking out the latest codes has failed somehow for $folder.
23     exit 1
24   fi
25   popd
26 }
27
28 # this attempts to copy all the contents in a folder called "from" into a folder
29 # called "to".  it's a failure for the "from" folder to not exist, but the "to"
30 # is allowed to not exist (in which case we don't try to synch to it).
31 function synch_directory_to_target()
32 {
33   local from="$1"; shift
34   local to="$1"; shift
35
36   sep
37
38   if [ ! -d "$from" ]; then
39     echo "skipping synch on missing source directory $from; this is not normal!"
40     exit 1
41   fi
42   if [ ! -d "$to" ]; then
43     echo "skipping synch into non-existent directory $to"
44     return
45   fi
46
47   echo "synching from $from into $to"
48   netcp "$from"/* "$to"/
49   if [ $? -ne 0 ]; then
50     echo "The synchronization of $from into $to has failed."
51     exit 1
52   fi
53 }
54