25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

ejabberdctl: Fix problem when running ejabberdctl in container

This commit is contained in:
Badlop 2024-02-08 13:56:33 +01:00
parent 9f934abd48
commit fa12301e08
2 changed files with 12 additions and 6 deletions

View File

@ -228,7 +228,9 @@ help()
# dynamic node name helper
uid() {
if erl -noinput -boot start_clean -eval 'case erlang:system_info(otp_release) >= "23" of true -> halt(1); _ -> halt(0) end.' ; then
ERTSVERSION="$("$ERL" -version 2>&1 | sed 's|.*\([0-9][0-9]\).*|\1|g')"
if [ $ERTSVERSION -lt 11 ] ; then # otp 23.0 includes erts 11.0
# Erlang/OTP lower than 23, which doesn's support dynamic node code
N=1
PF=$(( $$ % 97 ))
while
@ -241,11 +243,12 @@ uid() {
;;
esac
N=$(( N + 1 + ( $$ % 5 ) ))
epmd -names 2>/dev/null | grep -q " ${NN%@*} "
"$EPMD" -names 2>/dev/null | grep -q " ${NN%@*} "
do :; done
echo $NN
else
# for R23+ use native dynamic node code
# Erlang/OTP 23 or higher: use native dynamic node code
# https://www.erlang.org/patches/otp-23.0#OTP-13812
echo undefined
fi
}

View File

@ -249,7 +249,9 @@ help()
# dynamic node name helper
uid() {
if erl -noinput -boot start_clean -eval 'case erlang:system_info(otp_release) >= "23" of true -> halt(1); _ -> halt(0) end.' ; then
ERTSVERSION="$("$ERL" -version 2>&1 | sed 's|.*\([0-9][0-9]\).*|\1|g')"
if [ $ERTSVERSION -lt 11 ] ; then # otp 23.0 includes erts 11.0
# Erlang/OTP lower than 23, which doesn's support dynamic node code
N=1
PF=$(( $$ % 97 ))
while
@ -262,11 +264,12 @@ uid() {
;;
esac
N=$(( N + 1 + ( $$ % 5 ) ))
epmd -names 2>/dev/null | grep -q " ${NN%@*} "
"$EPMD" -names 2>/dev/null | grep -q " ${NN%@*} "
do :; done
echo $NN
else
# for R23+ use native dynamic node code
# Erlang/OTP 23 or higher: use native dynamic node code
# https://www.erlang.org/patches/otp-23.0#OTP-13812
echo undefined
fi
}