#!/bin/bash

source ../common.sh

echo "Securing OpenSim."
sudo chmod 600 ${OS_PATH}/config/*.ini
sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini
sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH}
sudo chmod -R 775 ${OS_PATH}
sudo chmod -R a-x ${OS_PATH}
sudo chmod -R a+X ${OS_PATH}
sudo chmod -R g+w ${OS_PATH}
sudo chmod -R a+x ${OS_PATH}/current/*.sh
sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh
sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh
sudo chmod a+x ${OS_PATH}/current/scripts/show-console
sudo chmod a+x ${OS_PATH}/current/scripts/start-sim

sudo chmod ug+rwx  ${OS_PATH}/config
sudo chmod g+s     ${OS_PATH}/config
sudo chmod 600 ${OS_PATH}/config/*.ini
sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini

chmod ug+rwx  ${OS_PATH}/caches
chmod o-rwx ${OS_PATH}/caches
chmod g+s ${OS_PATH}/caches