# Post installation script

# Dynamically populated directories that we expect to exist but do
# not want to remove when removing the RPM. Ideally, we would do this
# via the RPM building plugin, but adding empty directories is not
# supported.
install --directory --mode=755 /var/lib/hetu
install --directory --mode=755 /var/log/hetu

# Populate node.id from uuidgen by replacing template with the node uuid
sed -i "s/\$(uuid-generated-nodeid)/$(uuidgen)/g" /etc/hetu/node.properties

# move the hetu_env.sh created during pre-install to hetu config location
if [ -e /tmp/hetu_env.sh ]
then
    mv /tmp/hetu_env.sh /etc/hetu/env.sh
fi

chown -R hetu:hetu /var/lib/hetu
chown -R hetu:hetu /var/log/hetu
chown -R hetu:hetu /etc/hetu
