Changeset 30002 for other-projects
- Timestamp:
- 2015-07-02T18:07:44+12:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/crons-and-scripts/do-snapshots-and-latest.sh
r29998 r30002 18 18 gs3version=`cat /greenstone/greenstone.org/base/next-release-greenstone3.txt` 19 19 20 # array of string literals of source component/distribution suffixes 21 22 source_suffixes=("source-component.tar.gz" "source-component.zip" "source-distribution.tar.gz" "source-distribution.zip") 23 20 24 # static array of string literals representing the caveat file suffixes we're interested in 21 22 suffixes=("linux" "linux-x64" "Lion-MacOS-intel.dmg" "MacOS-intel.dmg" "windows.exe" "source-component.tar.gz" "source-component.zip" "source-distribution.tar.gz" "source-distribution.zip") 25 # see also 'Adding New Elements to the Original Array' 26 # at http://www.yourownlinux.com/2013/10/working-with-arrays-in-bash-scripting.html 27 28 suffixes=("linux" "linux-x64" "Lion-MacOS-intel.dmg" "MacOS-intel.dmg" "windows.exe" ${source_suffixes[@]}) 23 29 24 30 gs2_bin_prefix=Greenstone-$gs2version-candidate-$today- … … 184 190 cd $caveat_dir 185 191 for file in *; do 186 [[ -f $file ]] && [[ "$file" != *"latest-server.exe"]] && [[ "$file" != *"Greenstone3-latest-source.tar.gz" ]] && [[ $file -nt $latest ]] && latest=$file192 [[ -f $file ]] && [[ "$file" == "Greenstone-"* ]] && [[ "$file" != *"Greenstone3-latest-source.tar.gz" ]] && [[ $file -nt $latest ]] && latest=$file 187 193 done 188 194 cd - … … 192 198 # E.g. for testing, latest=Greenstone-3.07-candidate-2015.06.30-linux-x64 193 199 echo "Latest file in caveat is: $latest" 200 201 # splits the filename $latest by hyphens, -, and then gets the 2nd substring 202 # in this case the GS2 or GS3 full version number 203 # http://stackoverflow.com/questions/428109/extract-substring-in-bash 204 local matchfile=`echo $latest| cut -d'-' -f 2` 205 echo "Found gs version prefix: $matchfile" 194 206 195 207 # Iff this is a GS binary/src file that we want to maintain in the caveat/latest folder, … … 203 215 # Need double brackets below, [[]], for string expansion with wildcard 204 216 205 for suffix in ${suffixes[@]}; do 206 if [[ "$latest" == *"$suffix" ]]; then 207 echo "Found that suffix matched: $suffix" 208 209 # splits the filename $latest by hyphens, -, and then gets the 2nd substring 210 # in this case the GS2 or GS3 full version number 211 # http://stackoverflow.com/questions/428109/extract-substring-in-bash 212 local matchfile=`echo $latest| cut -d'-' -f 2` 213 echo "Found gs version prefix: $matchfile" 214 215 matchfile=${latest_dir}Greenstone-${matchfile}-candidate-*-${suffix} 216 217 218 # if the latest file is a src component or src dist, then all src comps and dists 219 # would have been uploaded simultaneously for that GS version. Check they're all there 220 # and remove any older equivalents in the caveat/latest directory. Then copy all the 221 # *source* files for this GS version over to caveat/latest 222 223 echo "" 224 if [[ "$latest" == *"-source-"* ]]; then 225 for suffix in ${source_suffixes[@]}; do 226 local srcfile=Greenstone-${matchfile}-candidate-${today}-${suffix} 227 local regexfile=Greenstone-${matchfile}-candidate-*-${suffix} 228 if [[ -f ${caveat_dir}$srcfile ]]; then 229 echo "Removing ${latest_dir}$regexfile" 230 echo "and replacing with ${latest_dir}$srcfile" 231 rm ${latest_dir}$regexfile 232 ln ${caveat_dir}$srcfile ${latest_dir}$srcfile 233 fi 234 done 235 236 else 237 # not src component or dist, but binary file, which are uploaded one at a time. 238 239 for suffix in ${suffixes[@]}; do 240 if [[ "$latest" == *"$suffix" ]]; then 241 echo "Found that suffix matched: $suffix" 242 243 matchfile=${latest_dir}Greenstone-${matchfile}-candidate-*-${suffix} 244 217 245 # remove the matching file from the caveat/latest folder 218 246 # we don't know it's date, so we substituted that portion with a * as wildcard 219 247 # E.g. matchfile=<caveat>/latest/Greenstone-2.87-candidate-*-source-component.tar.gz 220 221 222 223 248 249 echo "Removing $matchfile" 250 rm $matchfile 251 224 252 # make a hardlink of the $latest file into the caveat_latest folder 225 echo "Making a hardlink to ${caveat_dir}$latest in ${latest_dir}$latest" 226 ln ${caveat_dir}$latest ${latest_dir}$latest 227 #else 228 #echo "$latest did not match $suffix" 229 fi 230 done 253 echo "Making a hardlink to ${caveat_dir}$latest in ${latest_dir}$latest" 254 ln ${caveat_dir}$latest ${latest_dir}$latest 255 #else 256 #echo "$latest did not match $suffix" 257 fi 258 done 259 fi 231 260 232 261 echo ""
Note:
See TracChangeset
for help on using the changeset viewer.