Project

General

Profile

combined_v3_10762_patches_151104.patch

Marco Mambelli, 11/04/2015 05:12 PM

View differences:

creation/web_base/glidein_startup.sh
1259 1259
            fi
1260 1260
            return 0
1261 1261
        fi
1262
        warn "Not enough arguments in fetch_file $@" 1>&2
1262
        warn "Not enough arguments in fetch_file ($#/$IFS): $@" 1>&2
1263 1263
        glidein_exit 1
1264 1264
    fi
1265 1265

  
1266
- 
creation/web_base/glidein_startup.sh
820 820
  fi
821 821
fi
822 822

  
823
function md5wrapper {
824
    # $1 - file name
825
    # $2 - option (quiet)
826
    local ONLY_SUM
827
    if [ "x$2" = "xquiet" ]; then
828
        ONLY_SUM=yes
829
    fi
830
    local executable=md5sum
831
    which $executable 1>/dev/null 2>&1
832
    if [ $? -ne 0 ]; then
833
        executable=md5
834
        which $executable 1>/dev/null 2>&1
835
        if [ $? -ne 0 ]; then
836
            echo "???"
837
            return 1
838
        fi
839
        [ -n "$ONLY_SUM" ] && executable="md5 -q \"$1\"" || executable="md5 \"$1\""
840
    else
841
        [ -n "$ONLY_SUM" ] && executable="md5sum \"$1\" | cut -d ' ' -f 1" ||  executable="md5sum \"$1\""
842
    fi
843
    local res
844
    res="`eval "$executable" 2>/dev/null`"
845
    if [ $? -ne 0 ]; then
846
        echo "???"
847
        return 1
848
    fi
849
    echo "$res"  
850
}
851

  
852

  
823 853
startup_time=`date +%s`
824 854
echo "Starting glidein_startup.sh at `date` ($startup_time)"
855
echo "script_checksum   = '`md5wrapper "$0"`'"
825 856
echo "debug_mode        = '$operation_mode'"
826 857
echo "condorg_cluster   = '$condorg_cluster'"
827 858
echo "condorg_subcluster= '$condorg_subcluster'"
......
1259 1290
            fi
1260 1291
            return 0
1261 1292
        fi
1262
        warn "Not enough arguments in fetch_file ($#/$IFS): $@" 1>&2
1293
        printf -v ifs_str '%q' "$IFS"
1294
        warn "Not enough arguments in fetch_file ($#/$ifs_str): $@" 1>&2
1263 1295
        glidein_exit 1
1264 1296
    fi
1265 1297

  
1266
- 
creation/web_base/glidein_startup.sh
6 6
# File Version: 
7 7
#
8 8

  
9
# default IFS, to protect against unusual environment, better than "unset IFS" because works with restoring old one
10
IFS=$' \t\n'
11

  
9 12
global_args="$@"
10 13

  
11 14
export LANG=C
......
829 832
    fi
830 833
    local executable=md5sum
831 834
    which $executable 1>/dev/null 2>&1
832
    if [ $? -ne 0 ]; then
835
    if [ "$?" -ne 0 ]; then
833 836
        executable=md5
834 837
        which $executable 1>/dev/null 2>&1
835
        if [ $? -ne 0 ]; then
838
        if [ "$?" -ne 0 ]; then
836 839
            echo "???"
837 840
            return 1
838 841
        fi
......
1280 1283
}
1281 1284

  
1282 1285
function fetch_file {
1283
    if [ $# -ne 7 ]; then
1284
        if [ $# -eq 6 ]; then
1286
    if [ "$#" -ne 7 ]; then
1287
        if [ "$#" -eq 6 ]; then
1285 1288
            # added to maintain compatibility with old file list format
1286 1289
            #TODO: remove in version 3.3
1287 1290
            fetch_file_try "$1" "$2" "$3" "$4" 0 "$5" "$6"
1288
            if [ $? -ne 0 ]; then
1291
            if [ "$?" -ne 0 ]; then
1289 1292
	        glidein_exit 1
1290 1293
            fi
1291 1294
            return 0
1292 1295
        fi
1296
        local ifs_str
1293 1297
        printf -v ifs_str '%q' "$IFS"
1294 1298
        warn "Not enough arguments in fetch_file ($#/$ifs_str): $@" 1>&2
1295 1299
        glidein_exit 1
1296 1300
    fi
1297 1301

  
1298 1302
    fetch_file_try "$1" "$2" "$3" "$4" "$5" "$6" "$7"
1299
    if [ $? -ne 0 ]; then
1303
    if [ "$?" -ne 0 ]; then
1300 1304
        glidein_exit 1
1301 1305
    fi
1302 1306
    return 0
1303
-