Imported Upstream version 1.5.1
This commit is contained in:
25
packaging/generate_uuid
Executable file
25
packaging/generate_uuid
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/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
|
||||
78
packaging/postinstall_setup.sh
Normal file
78
packaging/postinstall_setup.sh
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
XTREEMFS_LOG_DIR=/var/log/xtreemfs
|
||||
XTREEMFS_HOME=/var/lib/xtreemfs
|
||||
XTREEMFS_ETC=/etc/xos/xtreemfs
|
||||
XTREEMFS_USER=xtreemfs
|
||||
XTREEMFS_GROUP=xtreemfs
|
||||
XTREEMFS_GENERATE_UUID_SCRIPT="${XTREEMFS_ETC}/generate_uuid"
|
||||
|
||||
# When executed during POST installation, do not be verbose.
|
||||
VERBOSE=0
|
||||
script_name=$(basename "$0")
|
||||
if [ "$script_name" = "postinstall_setup.sh" ]
|
||||
then
|
||||
VERBOSE=1
|
||||
fi
|
||||
|
||||
# generate UUIDs
|
||||
if [ -x "$XTREEMFS_GENERATE_UUID_SCRIPT" ]; then
|
||||
for service in dir mrc osd; do
|
||||
"$XTREEMFS_GENERATE_UUID_SCRIPT" "${XTREEMFS_ETC}/${service}config.properties"
|
||||
[ $VERBOSE -eq 1 ] && echo "Generated UUID for service: $service"
|
||||
done
|
||||
else
|
||||
echo "UUID can't be generated automatically. Please enter a correct UUID in each config file of an XtreemFS service."
|
||||
fi
|
||||
|
||||
|
||||
group_exists=`grep -c $XTREEMFS_GROUP /etc/group || true`
|
||||
if [ $group_exists -eq 0 ]; then
|
||||
groupadd $XTREEMFS_GROUP
|
||||
[ $VERBOSE -eq 1 ] && echo "created group $XTREEMFS_GROUP"
|
||||
fi
|
||||
exists=`grep -c $XTREEMFS_USER /etc/passwd || true`
|
||||
if [ $exists -eq 0 ]; then
|
||||
mkdir $XTREEMFS_HOME
|
||||
useradd -r --home $XTREEMFS_HOME -g $XTREEMFS_GROUP $XTREEMFS_USER
|
||||
chown $XTREEMFS_USER $XTREEMFS_HOME
|
||||
[ $VERBOSE -eq 1 ] && echo "created user $XTREEMFS_USER and data directory $XTREEMFS_HOME"
|
||||
fi
|
||||
if [ ! -d $XTREEMFS_HOME ]; then
|
||||
mkdir -m750 $XTREEMFS_HOME
|
||||
chown $XTREEMFS_USER $XTREEMFS_HOME
|
||||
[ $VERBOSE -eq 1 ] && echo "user $XTREEMFS_USER exists but data directory $XTREEMFS_HOME had to be created"
|
||||
fi
|
||||
owner=`stat -c %U $XTREEMFS_HOME`
|
||||
if [ "$owner" != "$XTREEMFS_USER" ]; then
|
||||
[ $VERBOSE -eq 1 ] && echo "directory $XTREEMFS_HOME is not owned by $XTREEMFS_USER, executing chown"
|
||||
chown $XTREEMFS_USER $XTREEMFS_HOME
|
||||
fi
|
||||
|
||||
if [ ! -e $XTREEMFS_LOG_DIR ]; then
|
||||
mkdir $XTREEMFS_LOG_DIR
|
||||
chown -R $XTREEMFS_USER $XTREEMFS_LOG_DIR
|
||||
fi
|
||||
|
||||
if [ -e $XTREEMFS_ETC ]; then
|
||||
group=`stat -c %G $XTREEMFS_ETC 2>/dev/null`
|
||||
if [ $group != $XTREEMFS_GROUP ]; then
|
||||
[ $VERBOSE -eq 1 ] && echo "directory $XTREEMFS_ETC is owned by $group, should be owned by $XTREEMFS_GROUP, executing chgrp (may take some time)"
|
||||
chgrp -R $XTREEMFS_GROUP $XTREEMFS_ETC
|
||||
fi
|
||||
for file in `ls $XTREEMFS_ETC/*.properties 2>/dev/null`; do
|
||||
if [ -f $file -a "$(stat -c %a $file)" != "640" ]; then
|
||||
[ $VERBOSE -eq 1 ] && echo "setting $file 0640, executing chmod"
|
||||
chmod 0640 $file
|
||||
fi
|
||||
done
|
||||
if [ -d "$XTREEMFS_ETC/truststore/" ]
|
||||
then
|
||||
if [ "$(stat -c %a "$XTREEMFS_ETC/truststore/")" != "750" ]
|
||||
then
|
||||
[ $VERBOSE -eq 1 ] && echo "setting $XTREEMFS_ETC/truststore/ to 0750, executing chmod (may take some time)"
|
||||
chmod -R u=rwX,g=rX,o= $XTREEMFS_ETC/truststore/
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user