diff --git a/OBI.php b/OBI.php index 59b05ee..f0a51e5 100644 --- a/OBI.php +++ b/OBI.php @@ -76,21 +76,26 @@ if (isset($_POST['save']) && $_POST['save']) { if (empty($input_errors)) { $config['onebuttoninstaller']['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $config['onebuttoninstaller']['storage_path'] = rtrim($config['onebuttoninstaller']['storage_path'],'/'); // ensure to have NO trailing slash - if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); - change_perms($config['onebuttoninstaller']['storage_path']); - $install_dir = $config['onebuttoninstaller']['storage_path']."/"; // get directory where the installer script resides - if (!is_dir("{$install_dir}onebuttoninstaller/log")) { mkdir("{$install_dir}onebuttoninstaller/log", 0775, true); } - $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); - if ($return_val == 0) { - chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); - require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + if (strpos($config['onebuttoninstaller']['storage_path'], "/mnt/") === false) { + $input_errors[] = gettext("The common directory for all extensions MUST be set to a directory below '/mnt/' to prevent to loose the extensions after a reboot on embedded systems!"); } - else { - $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); - exit; + else { + if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); + change_perms($config['onebuttoninstaller']['storage_path']); + $install_dir = $config['onebuttoninstaller']['storage_path']."/"; // get directory where the installer script resides + if (!is_dir("{$install_dir}onebuttoninstaller/log")) { mkdir("{$install_dir}onebuttoninstaller/log", 0775, true); } + $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); + if ($return_val == 0) { + chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); + require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + } + else { + $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + exit; + } + mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); + header("Location:onebuttoninstaller-config.php"); } - mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); - header("Location:onebuttoninstaller-config.php"); } } @@ -111,7 +116,7 @@ include("fbegin.inc"); ?>