aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2021-12-21 18:09:18 +0100
committerBadlop <badlop@process-one.net>2021-12-23 13:56:58 +0100
commitb5d8b224867699c59b45b79fa4ab8a130aa5ca1f (patch)
tree99a25c27e0a0f5d0917cc6064f37f3f9b1474f3c
parentIn POSIX sh, OSTYPE is undefined. ejabberd doesn't work natively in win anyway (diff)
In POSIX sh, RANDOM is undefined, use alternative
-rwxr-xr-xejabberdctl.template3
1 files changed, 2 insertions, 1 deletions
diff --git a/ejabberdctl.template b/ejabberdctl.template
index 730bfcae9..7b7f25c51 100755
--- a/ejabberdctl.template
+++ b/ejabberdctl.template
@@ -198,8 +198,9 @@ help()
uid()
{
uuid=$(uuidgen 2>/dev/null)
+ random=$(awk 'BEGIN { srand(); print int(rand()*32768) }' /dev/null)
[ -z "$uuid" ] && [ -f /proc/sys/kernel/random/uuid ] && uuid=$(cat /proc/sys/kernel/random/uuid)
- [ -z "$uuid" ] && uuid=$(printf "%X" "${RANDOM:-$$}$(date +%M%S)")
+ [ -z "$uuid" ] && uuid=$(printf "%X" "${random:-$$}$(date +%M%S)")
uuid=$(printf '%s' $uuid | sed 's/^\(...\).*$/\1/')
[ $# -eq 0 ] && echo "${uuid}-${ERLANG_NODE}"
[ $# -eq 1 ] && echo "${uuid}-${1}-${ERLANG_NODE}"