Skip to content
Snippets Groups Projects
Commit b4918f6f authored by ale's avatar ale
Browse files

Work around lack of $RANDOM in dash

parent 94af59f1
Branches master
No related tags found
No related merge requests found
Pipeline #1270 passed
...@@ -8,14 +8,15 @@ DATADIR=/data ...@@ -8,14 +8,15 @@ DATADIR=/data
# Get or generate a unique server ID. # Get or generate a unique server ID.
get_server_id() { get_server_id() {
if [ ! -e ${DATADIR}/.server-id ]; then if [ ! -e ${DATADIR}/.server-id ]; then
echo $RANDOM > ${DATADIR}/.server-id # Oops, dash has no $RANDOM.
shuf -i 1-65535 -n 1 > ${DATADIR}/.server-id
fi fi
cat ${DATADIR}/.server-id cat ${DATADIR}/.server-id
} }
# Configure the server, replication state is unknown yet. # Configure the server, replication state is unknown yet.
configure_server() { configure_server() {
local server_id=$(get_server_id) local server_id=`get_server_id`
echo "Server ID is ${server_id}" >&2 echo "Server ID is ${server_id}" >&2
# If /data/conf.d exists, load configuration snippets from there. # If /data/conf.d exists, load configuration snippets from there.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment