|
17 | 17 | # REVISION: nomadzzz, armgham, beh-rouz, amini8, mahdibahramih, armineslami
|
18 | 18 | #===============================================================================
|
19 | 19 |
|
| 20 | +export TOP_PID=$$ |
| 21 | + |
20 | 22 | # Function fncLongIntToStr
|
21 | 23 | # converts IP in long integer format to a string
|
22 | 24 | fncLongIntToStr() {
|
@@ -378,20 +380,19 @@ export -f fncCheckIPList
|
378 | 380 | # Function fncCheckDpnd
|
379 | 381 | # Check for dipendencies
|
380 | 382 | function fncCheckDpnd {
|
381 |
| - osVersion="Linux" |
| 383 | + osVersion="NULL" |
382 | 384 | if [[ "$(uname)" == "Linux" ]]; then
|
| 385 | + command -v jq >/dev/null 2>&1 || { echo >&2 "I require 'jq' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 386 | + command -v parallel >/dev/null 2>&1 || { echo >&2 "I require 'parallel' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 387 | + command -v bc >/dev/null 2>&1 || { echo >&2 "I require 'bc' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 388 | + command -v timeout >/dev/null 2>&1 || { echo >&2 "I require 'timeout' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
383 | 389 | osVersion="Linux"
|
384 |
| - command -v jq >/dev/null 2>&1 || { echo >&2 "I require 'jq' but it's not installed. Please install it and try again."; exit 1; } |
385 |
| - command -v parallel >/dev/null 2>&1 || { echo >&2 "I require 'parallel' but it's not installed. Please install it and try again."; exit 1; } |
386 |
| - command -v bc >/dev/null 2>&1 || { echo >&2 "I require 'bc' but it's not installed. Please install it and try again."; exit 1; } |
387 |
| - command -v timeout >/dev/null 2>&1 || { echo >&2 "I require 'timeout' but it's not installed. Please install it and try again."; exit 1; } |
388 |
| - |
389 | 390 | elif [[ "$(uname)" == "Darwin" ]];then
|
| 391 | + command -v jq >/dev/null 2>&1 || { echo >&2 "I require 'jq' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 392 | + command -v parallel >/dev/null 2>&1 || { echo >&2 "I require 'parallel' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 393 | + command -v bc >/dev/null 2>&1 || { echo >&2 "I require 'bc' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
| 394 | + command -v gtimeout >/dev/null 2>&1 || { echo >&2 "I require 'gtimeout' but it's not installed. Please install it and try again."; kill -s 1 "$TOP_PID"; } |
390 | 395 | osVersion="Mac"
|
391 |
| - command -v jq >/dev/null 2>&1 || { echo >&2 "I require 'jq' but it's not installed. Please install it and try again."; exit 1; } |
392 |
| - command -v parallel >/dev/null 2>&1 || { echo >&2 "I require 'parallel' but it's not installed. Please install it and try again."; exit 1; } |
393 |
| - command -v bc >/dev/null 2>&1 || { echo >&2 "I require 'bc' but it's not installed. Please install it and try again."; exit 1; } |
394 |
| - command -v gtimeout >/dev/null 2>&1 || { echo >&2 "I require 'gtimeout' but it's not installed. Please install it and try again."; exit 1; } |
395 | 396 | fi
|
396 | 397 | echo "$osVersion"
|
397 | 398 | }
|
|
0 commit comments