@@ -38,8 +38,15 @@ function _expandVar()
38
38
# Returns: 0 if first version gte second, otherwise 1
39
39
function version_greater_than()
40
40
{
41
- local date1=${1%% .* } time1=${1##* .}
42
- local date2=${2%% .* } time2=${2##* .}
41
+ local first=" " second=" "
42
+ first=$( trim " $1 " )
43
+ if [[ -z " $first " ]]; then
44
+ return 1
45
+ fi
46
+ second=$( trim " $2 " )
47
+
48
+ local date1=${first%% .* } time1=${first##* .}
49
+ local date2=${second%% .* } time2=${second##* .}
43
50
44
51
if [ " $date1 " -gt " $date2 " ]; then
45
52
return 0
@@ -70,7 +77,7 @@ function version_parse()
70
77
{
71
78
local var=$1
72
79
if [ " ${var} " == " ${CONTAINER_INSTALL_BUNDLE} " ]; then
73
- var=$( unzip -l " ${var} " | grep -Po ' oracle.mgmt_agent-\d{6}.\d{4}.linux.zip' )
80
+ var=$( unzip -l " ${var} " | grep -Po ' oracle.mgmt_agent-\d{6}.\d{4}.linux.*. zip' )
74
81
fi
75
82
var=${var##*/ }
76
83
var=${var# " ${var%% [[:digit:]]* } " }
@@ -86,17 +93,15 @@ function version_parse()
86
93
# Returns: 0 if execution is successful, 1 otherwise
87
94
function execute_cmd()
88
95
{
89
- local cmd=" $1 "
90
- local operation=" $2 "
96
+ local cmd=" $1 " operation=" $2 " output=" " status=-1
91
97
log " Executing ($operation ): $cmd "
92
- eval " $cmd "
93
-
94
- local cmd_exit_code=$?
95
- if [ $cmd_exit_code -eq 0 ]; then
96
- log " $APPNAME $operation successful [status: $cmd_exit_code ]"
98
+ output=" $( eval " $cmd " 2>&1 ) "
99
+ status=$?
100
+ if [ $status -eq 0 ]; then
101
+ log " $APPNAME $operation successful [status: $status , output: $output ]"
97
102
return 0
98
103
else
99
- log " $APPNAME $operation failed [status: $cmd_exit_code ]"
104
+ log " $APPNAME $operation failed [status: $status , output: $output ]"
100
105
return 1
101
106
fi
102
107
}
0 commit comments