xtreemfs/packaging/generate_uuid

25 lines
934 B
Plaintext
Raw Normal View History

2020-09-22 02:25:22 +02:00
#!/bin/bash
# this scripts uses the tool 'uuidgen'
CFGFILE=$1 #name of the config file (osdconfig, mrcconfig)
grep -e '^uuid\W*=\W*\w\+' $CFGFILE > /dev/null
if [ $? -ne 0 ]
then
UUID=`which uuidgen`
if [ $? -ne 0 ]
then
UUID=$RANDOM"-"$RANDOM"-"$RANDOM"-"$RANDOM
echo "WARNING: uuidgen is not available, the generated UUID contains just random numbers. THIS UUID IS PROBABLY NOT UNIQUE, PLEASE CREATE A REAL UUID IF YOU INTEND TO USE THIS SERVICE IN A MULTI-SERVER ENVIRONMENT."
else
UUID=`$UUID`
fi
echo "" >> $CFGFILE
echo "# The UUID is the globally unique name of this service." >> $CFGFILE
echo "# You must not change the UUID once the service has been used" >> $CFGFILE
echo "# to change the address/hostname or port of a service please" >> $CFGFILE
echo "# change the UUID Mapping in the directory service." >> $CFGFILE
echo "uuid = "$UUID >> $CFGFILE
fi