diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit b/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit index 707fc93..3facf76 100644 --- a/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit +++ b/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit @@ -3,10 +3,9 @@ $command = "fail2ban_start.sh"; $cmd = dirname(__FILE__)."/".$command; require_once("config.inc"); require_once("functions.inc"); - $i =0; if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { - for ($i; $i < count($config['rc']['postinit']['cmd']);) { - if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; ++$i; } + for ($i = 0; $i < count($config['rc']['postinit']['cmd']); $i++) { + if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; } } $config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd"; write_config(); diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit b/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit index bfe902a..b028938 100644 --- a/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit +++ b/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit @@ -3,10 +3,9 @@ $command = "mcommander.sh"; $cmd = dirname(__FILE__)."/".$command; require_once("config.inc"); require_once("functions.inc"); - $i =0; if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { - for ($i; $i < count($config['rc']['postinit']['cmd']);) { - if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; ++$i; } + for ($i = 0; $i < count($config['rc']['postinit']['cmd']); $i++) { + if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; } } $config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd"; write_config(); diff --git a/onebuttoninstaller/ext/onebuttoninstaller-config.php b/onebuttoninstaller/ext/onebuttoninstaller-config.php index 71ae02a..cb6954e 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller-config.php +++ b/onebuttoninstaller/ext/onebuttoninstaller-config.php @@ -83,15 +83,17 @@ if (isset($_POST['save']) && $_POST['save']) { if (isset($_POST['enable'])) { $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 (strpos($config['onebuttoninstaller']['storage_path'], "/mnt/") === false) { + if (!isset($_POST['path_check']) && (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 { if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); change_perms($_POST['storage_path']); + $config['onebuttoninstaller']['path_check'] = isset($_POST['path_check']) ? true : false; $config['onebuttoninstaller']['auto_update'] = isset($_POST['auto_update']) ? true : false; $config['onebuttoninstaller']['show_beta'] = isset($_POST['show_beta']) ? true : false; $savemsg .= get_std_save_message(write_config()); + require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php"); } } else $savemsg .= get_std_save_message(write_config()); @@ -100,9 +102,16 @@ if (isset($_POST['save']) && $_POST['save']) { $pconfig['enable'] = isset($config['onebuttoninstaller']['enable']) ? true : false; $pconfig['storage_path'] = !empty($config['onebuttoninstaller']['storage_path']) ? $config['onebuttoninstaller']['storage_path'] : $g['media_path']; +$pconfig['path_check'] = isset($config['onebuttoninstaller']['path_check']) ? true : false; $pconfig['auto_update'] = isset($config['onebuttoninstaller']['auto_update']) ? true : false; $pconfig['show_beta'] = isset($config['onebuttoninstaller']['show_beta']) ? true : false; +$return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}log/version.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/version.txt", false); +if ($return_val == 0) { + $server_version = exec("cat {$config['onebuttoninstaller']['rootfolder']}log/version.txt"); + if ($server_version != $config['onebuttoninstaller']['version']) { $savemsg = sprintf(gettext("New extension version %s available, use '%s' to install the new version!"), $server_version, gettext("Maintenance")); } +} //EOversion-check + bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language include("fbegin.inc"); bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?> @@ -112,6 +121,7 @@ function enable_change(enable_change) { var endis = !(document.iform.enable.checked || enable_change); document.iform.storage_path.disabled = endis; document.iform.storage_pathbrowsebtn.disabled = endis; + document.iform.path_check.disabled = endis; document.iform.auto_update.disabled = endis; document.iform.show_beta.disabled = endis; } @@ -138,6 +148,7 @@ function enable_change(enable_change) { /mnt/)."), $pconfig['storage_path'], true, 60);?> + diff --git a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php b/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php index 9b8d7f0..51a0d45 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php +++ b/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php @@ -48,20 +48,19 @@ else { $server_version = gettext("Unable to retrieve version from server!"); } if (isset($_POST['ext_remove']) && $_POST['ext_remove']) { // remove start/stop commands if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { - for ($i = 0; $i < count($config['rc']['postinit']['cmd']);) { + for ($i = 0; $i < count($config['rc']['postinit']['cmd']); $i++) { if (preg_match('/onebuttoninstaller/', $config['rc']['postinit']['cmd'][$i])) { unset($config['rc']['postinit']['cmd'][$i]);} else{} - ++$i; } } if ( is_array($config['rc']['shutdown'] ) && is_array( $config['rc']['shutdown']['cmd'] ) ) { - for ($i = 0; $i < count($config['rc']['shutdown']['cmd']); ) { + for ($i = 0; $i < count($config['rc']['shutdown']['cmd']); $i++) { if (preg_match('/onebuttoninstaller/', $config['rc']['shutdown']['cmd'][$i])) { unset($config['rc']['shutdown']['cmd'][$i]); } else {} - ++$i; } } // remove extension pages - mwexec ("rm -rf /usr/local/www/ext/onebuttoninstaller"); - mwexec ("rm -rf /usr/local/www/onebuttoninstaller*"); + mwexec("rm -rf /usr/local/www/ext/onebuttoninstaller"); + mwexec("rmdir -p /usr/local/www/ext"); // to prevent empty extensions menu entry in top GUI menu if there are no other extensions installed + mwexec("rm -rf /usr/local/www/onebuttoninstaller*"); // unlink created links if (is_link("/usr/local/share/locale-obi")) unlink("/usr/local/share/locale-obi"); // remove application section from config.xml diff --git a/onebuttoninstaller/ext/onebuttoninstaller.php b/onebuttoninstaller/ext/onebuttoninstaller.php index a06e9f7..ae28a16 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller.php +++ b/onebuttoninstaller/ext/onebuttoninstaller.php @@ -208,6 +208,12 @@ if (isset($_POST['update']) || (isset($config['onebuttoninstaller']['auto_update else $errormsg .= gettext("Unable to retrieve extensions list from server!")."
"; } // EOupdate +$return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}log/version.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/version.txt", false); +if ($return_val == 0) { + $server_version = exec("cat {$config['onebuttoninstaller']['rootfolder']}log/version.txt"); + if ($server_version != $config['onebuttoninstaller']['version']) { $savemsg = sprintf(gettext("New extension version %s available, use '%s' to install the new version!"), $server_version, gettext("Maintenance")); } +} //EOversion-check + if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt")."
"; bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language diff --git a/onebuttoninstaller/extensions.txt.SHA512-CHECKSUM b/onebuttoninstaller/extensions.txt.SHA512-CHECKSUM deleted file mode 100644 index 0645c26..0000000 --- a/onebuttoninstaller/extensions.txt.SHA512-CHECKSUM +++ /dev/null @@ -1 +0,0 @@ -c143308bd6f18d8d4c42c1daaab553cb1eeadca1e89db29909b93dfb80b0dc69ed5ea3e5cc91813f3598a9edf414750a101e2a0449d945eedeb448f1252a6132 diff --git a/onebuttoninstaller/onebuttoninstaller-install.php b/onebuttoninstaller/onebuttoninstaller-install.php index a4f1c37..18fbf85 100644 --- a/onebuttoninstaller/onebuttoninstaller-install.php +++ b/onebuttoninstaller/onebuttoninstaller-install.php @@ -29,7 +29,7 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -$v = "v0.2"; // extension version +$v = "v0.3"; // extension version $appname = "OneButtonInstaller"; require_once("config.inc"); diff --git a/onebuttoninstaller/release_notes.txt b/onebuttoninstaller/release_notes.txt index f2706f6..b3688d7 100644 --- a/onebuttoninstaller/release_notes.txt +++ b/onebuttoninstaller/release_notes.txt @@ -1,4 +1,6 @@ Version Date Description +0.3 2016.08.14 N: configuration - checkbox to override restriction for extensions installation path + (limited to a directory under /mnt/) 0.2 2016.08.09 N: configuration - enable/disable beta releases in extensions list N: check hardware platform to use midnightcommander on i386 too F: disabling extension not possible, leads to an error message diff --git a/onebuttoninstaller/version.txt b/onebuttoninstaller/version.txt index 3b04cfb..be58634 100644 --- a/onebuttoninstaller/version.txt +++ b/onebuttoninstaller/version.txt @@ -1 +1 @@ -0.2 +0.3