Ignore:
Timestamp:
2016-03-16T19:46:02+13:00 (7 years ago)
Author:
ak19
Message:

Finally got the upload of the binary to turn up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/expeditee-release-kits/process_incoming.sh

    r30408 r30410  
    33# This script is for use on the machine where the nightly Expeditee binaries are to be
    44# uploaded. Put this script in the same folder as the uploads are meant to go.
    5 # When any binary or its log *.out file is being uploaded via secure shell, this script
    6 # will be called. The invocation of this script should go into .ssh/authorizedkeys.
    7 # Then this script will delete all other files in this folder that have the same naming
    8 # pattern as the uploaded binary/log file, excepting any existing file with the current
    9 # date in its name (in case this turns out to be the uploaded file itself).
     5# When any binary's log *.out file is being uploaded via secure shell (which is fast),
     6# this script's called. The invocation of this script should go into .ssh/authorizedkeys.
     7# Then this script will delete all other log and binary files in this folder for the same
     8# os-release that are not of the current date (in case it's the uploaded file itself).
     9# The code didn't work if the binary was processed independent of the log file, since the
     10# bin's filename (and hence target os) could not be determined as it was still being
     11# uploaded.
    1012
    1113
    12 # http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script                                                                   
     14# http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script
    1315date=`date +%Y-%m-%d`
    1416
     
    1820#incoming_file=$1
    1921incoming_file=`ls -rt *$date* 2>/dev/null | tail -n 1`
    20 echo $incoming_file
     22#echo "Hello world. Incoming file: $incoming_file" >> out.txt
    2123
    2224# arrays
    2325# make sure -linux64 comes before linux, because we'll be matching against these
    2426# strings, so need the longest strings to be matched first.
    25 bin_suffix=("-linux64" "-linux" "-windows.exe" "-MacOS-intel-MountainLion.dmg")
    2627rke_suffix=("-linux64" "-linux" "-windows" "-mac-MountainLion")
    27 
     28os_substr=("-linux64" "-linux" "-windows" "-MountainLion")
     29#bin_suffix=("-linux64" "-linux" "-windows.exe" "-MacOS-intel-MountainLion.dmg")
    2830
    2931# http://stackoverflow.com/questions/2172352/in-bash-how-can-i-check-if-a-string-begins-with-some-value
     
    6365
    6466    shopt -u nullglob
    65 fi
    6667
    67 # binaries start with "Expeditee-1-"
    68 bin_file_pattern=
    69 if [[ $incoming_file == "Expeditee-"* ]] ; then
    70     for suffix in ${bin_suffix[@]}; do
    71     if [[ $incoming_file == *"$suffix" ]]; then
    72         bin_file_pattern="Expeditee-1-*$suffix"
     68    # We now know the OS for the binary associated with the rke log
     69    # that's being uploaded too. Delete all bins for this OS except
     70    # any with the current date.
     71
     72    bin_file_pattern=
     73    # binaries start with "Expeditee-1-"
     74    for os_str in ${os_substr[@]}; do
     75    if [[ $incoming_file == *"$os_str"* ]]; then
     76        bin_file_pattern="Expeditee-1-*$os_str*"
    7377        break
    7478    fi
    7579    done
    76 
     80   
    7781    # ONE WAY:
    7882    #echo "found $bin_file_pattern"
    7983    # -f to make it silent: will also be silent if there's nothing to rm
    8084    #rm -rf $bin_file_pattern
    81 
     85   
    8286    # OR:
    8387    # get rid of all files of the pattern that are not of the current date
     
    8791    for file in ${files[@]}; do
    8892    # set nullglob earlier, so won't be here if there's no file that matched
    89     if [[ $file != "Expeditee-1-$date$suffix" ]]; then
    90         echo "$file"
     93    if [[ $file != *"$date"* ]] || [[ $file != *"$os_str"* ]]; then
     94        echo "$file"       
    9195        rm -rf $file
    9296    fi
     
    9599fi
    96100
     101
    97102# clean up ._Expeditee-1-YYYY-MM-DD-MacOS-intel-MountainLion.dmg temp files
    98103#ls -la "._Expeditee*dmg"
Note: See TracChangeset for help on using the changeset viewer.