|
|
@ -495,6 +495,19 @@ _exists() {
|
|
|
|
return $ret
|
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_findcommand() {
|
|
|
|
|
|
|
|
_fcmd="$1"
|
|
|
|
|
|
|
|
if command >/dev/null 2>&1; then
|
|
|
|
|
|
|
|
command -v "$_fcmd"
|
|
|
|
|
|
|
|
elif _exists which; then
|
|
|
|
|
|
|
|
which "$_fcmd"
|
|
|
|
|
|
|
|
elif eval type type >/dev/null 2>&1; then
|
|
|
|
|
|
|
|
eval type $_fcmd | cut -d " " -f 3
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#a + b
|
|
|
|
#a + b
|
|
|
|
_math() {
|
|
|
|
_math() {
|
|
|
|
_m_opts="$@"
|
|
|
|
_m_opts="$@"
|
|
|
@ -5966,15 +5979,27 @@ install() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$NO_DETECT_SH" ]; then
|
|
|
|
if [ -z "$NO_DETECT_SH" ]; then
|
|
|
|
|
|
|
|
_bash_path=""
|
|
|
|
#Modify shebang
|
|
|
|
#Modify shebang
|
|
|
|
if _exists bash; then
|
|
|
|
if _exists bash; then
|
|
|
|
_bash_path="$(bash -c "command -v bash 2>/dev/null")"
|
|
|
|
_bash_path="$(bash -c "command -v bash 2>/dev/null")"
|
|
|
|
if [ -z "$_bash_path" ]; then
|
|
|
|
if [ -z "$_bash_path" ]; then
|
|
|
|
_bash_path="$(bash -c 'echo $SHELL')"
|
|
|
|
_bash_path="$(bash -c 'echo $SHELL')"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$_bash_path" ]; then
|
|
|
|
|
|
|
|
_info "Good, bash is found, so change the shebang to use bash as preferred."
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
_env="$(_findcommand env)"
|
|
|
|
|
|
|
|
_envret="$?"
|
|
|
|
|
|
|
|
_debug "_env" "$_env"
|
|
|
|
|
|
|
|
if [ "$_envret" = "0" ] && [ "$_env" ] && [ "$_env" != "/usr/bin/env" ]; then
|
|
|
|
|
|
|
|
_info "It seems env $_env is not in the default location."
|
|
|
|
|
|
|
|
_info "Let's change env shebang."
|
|
|
|
|
|
|
|
_bash_path="$_env sh"
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$_bash_path" ]; then
|
|
|
|
if [ "$_bash_path" ]; then
|
|
|
|
_info "Good, bash is found, so change the shebang to use bash as preferred."
|
|
|
|
|
|
|
|
_shebang='#!'"$_bash_path"
|
|
|
|
_shebang='#!'"$_bash_path"
|
|
|
|
_setShebang "$LE_WORKING_DIR/$PROJECT_ENTRY" "$_shebang"
|
|
|
|
_setShebang "$LE_WORKING_DIR/$PROJECT_ENTRY" "$_shebang"
|
|
|
|
for subf in $_SUB_FOLDERS; do
|
|
|
|
for subf in $_SUB_FOLDERS; do
|
|
|
|