Skip to content

Commit 68296ad

Browse files
ibulerbaijiangjie
authored andcommitted
perf: update check and shell opts
1 parent a03c1dc commit 68296ad

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

scripts/4_install_jumpserver.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
#
3+
export SHELLOPTS
34
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
45

56
. "${BASE_DIR}/utils.sh"
@@ -19,13 +20,16 @@ function pre_install() {
1920
log_error "$(gettext 'command not found, Please install it first') iptables"
2021
exit 1
2122
fi
22-
if command -v python&>/dev/null; then
23-
:
24-
elif command -v python2&>/dev/null; then
25-
:
26-
elif command -v python3&>/dev/null; then
27-
:
28-
else
23+
24+
found=0
25+
for cmd in python python2 python3; do
26+
if command -v "$cmd" &>/dev/null; then
27+
found=1
28+
break
29+
fi
30+
done
31+
32+
if [ $found -eq 0 ]; then
2933
log_error "$(gettext 'command not found, Please install it first') python"
3034
exit 1
3135
fi

scripts/7_upgrade.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22
#
3+
export SHELLOPTS
4+
35
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
46

57
. "${BASE_DIR}/utils.sh"

0 commit comments

Comments
 (0)