@@ -192,8 +192,23 @@ DATA_TRANSFER_SIZE
192
192
fi
193
193
194
194
# Check rsync, openssh & jq versions
195
+ commands=(" jq" " rsync" " ssh" )
196
+ missing_command=" "
197
+ for cmd in " ${commands[@]} " ; do
198
+ if ! command -v " $cmd " > /dev/null 2>&1 ; then
199
+ missing_command+=" $cmd "
200
+ fi
201
+ done
202
+
203
+ # Check if any command is missing
204
+ if [[ -n " $missing_command " ]]; then
205
+ echo " One or more required tools not found: $missing_command " 1>&2
206
+ echo " Please make sure the following utils are installed and available in your PATH: $missing_command " 1>&2
207
+ exit 1
208
+ fi
209
+
195
210
echo " ### Software versions" 1>&2
196
- rsync_version=$( rsync --version | grep ' version' | awk ' {print $3}' )
211
+ rsync_version=$( rsync --version | grep ' version' | awk ' {print $3}' | tr -cd ' [:digit:].\n ' )
197
212
if awk " BEGIN {exit !($rsync_version < $min_rsync )}" & > /dev/null; then
198
213
echo " rsync version $rsync_version in backup-host does not meet minimum requirements." 1>&2
199
214
echo " Please make sure you have the minimum required version of rsync: $min_rsync installed" 1>&2
@@ -202,7 +217,7 @@ DATA_TRANSFER_SIZE
202
217
echo " rsync ${rsync_version} >= required ($min_rsync )" 1>&2
203
218
fi
204
219
205
- ssh_version=$( ssh -V 2>&1 | awk ' {print $1}' | grep -oPm 1 ' [\d\.]+' | head -1)
220
+ ssh_version=$( ssh -V 2>&1 | awk ' {print $1}' | grep -oPm 1 ' [\d\.]+' | head -1 | tr -cd ' [:digit:].\n ' )
206
221
if awk " BEGIN {exit !($ssh_version < $min_openssh )}" & > /dev/null; then
207
222
echo " openSSH version $ssh_version in backup-host does not meet minimum requirements." 1>&2
208
223
echo " Please make sure the minimum required version of openSSH: $min_openssh is installed" 1>&2
@@ -211,7 +226,7 @@ DATA_TRANSFER_SIZE
211
226
echo " openSSH ${ssh_version} >= required ($min_openssh )" 1>&2
212
227
fi
213
228
214
- jq_version=$( jq --version | awk -F\- ' {print $2}' )
229
+ jq_version=$( jq --version | awk -F\- ' {print $2}' | tr -cd ' [:digit:].\n ' )
215
230
if awk " BEGIN {exit !($jq_version < $min_jq )}" & > /dev/null; then
216
231
echo " jq version $jq_version in backup-host does not meet minimum requirements." 1>&2
217
232
echo " Please make sure you have the minimum required version of jq: $min_jq installed" 1>&2
0 commit comments