From 513e389a24a06f127127d0337f61aafdd6035f76 Mon Sep 17 00:00:00 2001 From: szaimen Date: Sat, 4 Dec 2021 11:01:38 +0100 Subject: [PATCH] make the datadirectory more robust Signed-off-by: szaimen --- Containers/mastercontainer/start.sh | 3 +++ php/src/Data/ConfigurationManager.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Containers/mastercontainer/start.sh b/Containers/mastercontainer/start.sh index b085ee0b..55921926 100644 --- a/Containers/mastercontainer/start.sh +++ b/Containers/mastercontainer/start.sh @@ -10,6 +10,9 @@ print_green() { if ! [ -a "/var/run/docker.sock" ]; then echo "Docker socket is not available. Cannot continue." exit 1 +elif ! mountpoint -q "/mnt/docker-aio-config"; then + echo "/mnt/docker-aio-config is not a mountpoint. Cannot proceed!" + exit 1 elif ! sudo -u www-data test -r /var/run/docker.sock; then echo "Trying to fix docker.sock permissions internally..." GROUP="$(stat -c '%g' /var/run/docker.sock)" diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index f772988b..17bb504a 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -193,9 +193,12 @@ class ConfigurationManager $this->WriteConfig($config); } + /** + * @throws InvalidSettingConfigurationException + */ public function WriteConfig(array $config) : void { if(!is_dir(DataConst::GetDataDirectory())) { - mkdir(DataConst::GetDataDirectory()); + throw new InvalidSettingConfigurationException(DataConst::GetDataDirectory() . " does not exist! Something was set up falsely!"); } file_put_contents(DataConst::GetConfigFile(), json_encode($config)); }