1 Commits
v0.2 ... v0.3

Author SHA1 Message Date
crestAT
061867ff8b v0.3
N: configuration - checkbox to override restriction for extensions
installation path (limited to a directory under /mnt/)
2016-08-14 08:55:54 +02:00
9 changed files with 31 additions and 16 deletions

View File

@@ -3,10 +3,9 @@ $command = "fail2ban_start.sh";
$cmd = dirname(__FILE__)."/".$command; $cmd = dirname(__FILE__)."/".$command;
require_once("config.inc"); require_once("config.inc");
require_once("functions.inc"); require_once("functions.inc");
$i =0;
if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) {
for ($i; $i < count($config['rc']['postinit']['cmd']);) { for ($i = 0; $i < count($config['rc']['postinit']['cmd']); $i++) {
if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; ++$i; } if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; }
} }
$config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd"; $config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd";
write_config(); write_config();

View File

@@ -3,10 +3,9 @@ $command = "mcommander.sh";
$cmd = dirname(__FILE__)."/".$command; $cmd = dirname(__FILE__)."/".$command;
require_once("config.inc"); require_once("config.inc");
require_once("functions.inc"); require_once("functions.inc");
$i =0;
if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) {
for ($i; $i < count($config['rc']['postinit']['cmd']);) { for ($i = 0; $i < count($config['rc']['postinit']['cmd']); $i++) {
if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; ++$i; } if (preg_match("/$command/", $config['rc']['postinit']['cmd'][$i])) break; }
} }
$config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd"; $config['rc']['postinit']['cmd'][$i] = $config['cmd']."$cmd";
write_config(); write_config();

View File

@@ -83,15 +83,17 @@ if (isset($_POST['save']) && $_POST['save']) {
if (isset($_POST['enable'])) { if (isset($_POST['enable'])) {
$config['onebuttoninstaller']['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $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 $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 <b>'/mnt/'</b> to prevent to loose the extensions after a reboot on embedded systems!"); $input_errors[] = gettext("The common directory for all extensions MUST be set to a directory below <b>'/mnt/'</b> to prevent to loose the extensions after a reboot on embedded systems!");
} }
else { else {
if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true);
change_perms($_POST['storage_path']); 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']['auto_update'] = isset($_POST['auto_update']) ? true : false;
$config['onebuttoninstaller']['show_beta'] = isset($_POST['show_beta']) ? true : false; $config['onebuttoninstaller']['show_beta'] = isset($_POST['show_beta']) ? true : false;
$savemsg .= get_std_save_message(write_config()); $savemsg .= get_std_save_message(write_config());
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php");
} }
} }
else $savemsg .= get_std_save_message(write_config()); 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['enable'] = isset($config['onebuttoninstaller']['enable']) ? true : false;
$pconfig['storage_path'] = !empty($config['onebuttoninstaller']['storage_path']) ? $config['onebuttoninstaller']['storage_path'] : $g['media_path']; $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['auto_update'] = isset($config['onebuttoninstaller']['auto_update']) ? true : false;
$pconfig['show_beta'] = isset($config['onebuttoninstaller']['show_beta']) ? 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 bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language
include("fbegin.inc"); include("fbegin.inc");
bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?> bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?>
@@ -112,6 +121,7 @@ function enable_change(enable_change) {
var endis = !(document.iform.enable.checked || enable_change); var endis = !(document.iform.enable.checked || enable_change);
document.iform.storage_path.disabled = endis; document.iform.storage_path.disabled = endis;
document.iform.storage_pathbrowsebtn.disabled = endis; document.iform.storage_pathbrowsebtn.disabled = endis;
document.iform.path_check.disabled = endis;
document.iform.auto_update.disabled = endis; document.iform.auto_update.disabled = endis;
document.iform.show_beta.disabled = endis; document.iform.show_beta.disabled = endis;
} }
@@ -138,6 +148,7 @@ function enable_change(enable_change) {
<?php html_titleline_checkbox("enable", gettext("OneButtonInstaller"), $pconfig['enable'], gettext("Enable"), "enable_change(false)");?> <?php html_titleline_checkbox("enable", gettext("OneButtonInstaller"), $pconfig['enable'], gettext("Enable"), "enable_change(false)");?>
<?php html_text("installation_directory", gettext("Installation directory"), sprintf(gettext("The extension is installed in %s"), $config['onebuttoninstaller']['rootfolder']));?> <?php html_text("installation_directory", gettext("Installation directory"), sprintf(gettext("The extension is installed in %s"), $config['onebuttoninstaller']['rootfolder']));?>
<?php html_filechooser("storage_path", gettext("Common directory"), $pconfig['storage_path'], gettext("Common directory for all extensions (a persistant place where all extensions are/should be - a directory below <b>/mnt/</b>)."), $pconfig['storage_path'], true, 60);?> <?php html_filechooser("storage_path", gettext("Common directory"), $pconfig['storage_path'], gettext("Common directory for all extensions (a persistant place where all extensions are/should be - a directory below <b>/mnt/</b>)."), $pconfig['storage_path'], true, 60);?>
<?php html_checkbox("path_check", gettext("Path check"), $pconfig['path_check'], gettext("If this option is selected no examination of the common directory path will be carried out (whether it was set to a directory below /mnt/)."), gettext("Please use this option only if you know what you are doing!"), false);?>
<?php html_checkbox("auto_update", gettext("Update"), $pconfig['auto_update'], gettext("Update extensions list automatically."), "", false);?> <?php html_checkbox("auto_update", gettext("Update"), $pconfig['auto_update'], gettext("Update extensions list automatically."), "", false);?>
<?php html_checkbox("show_beta", gettext("Beta releases"), $pconfig['show_beta'], gettext("If enabled, extensions in beta state will be shown in the extensions list."), "", false);?> <?php html_checkbox("show_beta", gettext("Beta releases"), $pconfig['show_beta'], gettext("If enabled, extensions in beta state will be shown in the extensions list."), "", false);?>
</table> </table>

View File

@@ -48,20 +48,19 @@ else { $server_version = gettext("Unable to retrieve version from server!"); }
if (isset($_POST['ext_remove']) && $_POST['ext_remove']) { if (isset($_POST['ext_remove']) && $_POST['ext_remove']) {
// remove start/stop commands // remove start/stop commands
if ( is_array($config['rc']['postinit'] ) && is_array( $config['rc']['postinit']['cmd'] ) ) { 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{} 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'] ) ) { 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 {} if (preg_match('/onebuttoninstaller/', $config['rc']['shutdown']['cmd'][$i])) { unset($config['rc']['shutdown']['cmd'][$i]); } else {}
++$i;
} }
} }
// remove extension pages // remove extension pages
mwexec ("rm -rf /usr/local/www/ext/onebuttoninstaller"); mwexec("rm -rf /usr/local/www/ext/onebuttoninstaller");
mwexec ("rm -rf /usr/local/www/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 // unlink created links
if (is_link("/usr/local/share/locale-obi")) unlink("/usr/local/share/locale-obi"); if (is_link("/usr/local/share/locale-obi")) unlink("/usr/local/share/locale-obi");
// remove application section from config.xml // remove application section from config.xml

View File

@@ -208,6 +208,12 @@ if (isset($_POST['update']) || (isset($config['onebuttoninstaller']['auto_update
else $errormsg .= gettext("Unable to retrieve extensions list from server!")."<br />"; else $errormsg .= gettext("Unable to retrieve extensions list from server!")."<br />";
} // EOupdate } // 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")."<br />"; if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt")."<br />";
bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language

View File

@@ -1 +0,0 @@
c143308bd6f18d8d4c42c1daaab553cb1eeadca1e89db29909b93dfb80b0dc69ed5ea3e5cc91813f3598a9edf414750a101e2a0449d945eedeb448f1252a6132

View File

@@ -29,7 +29,7 @@
of the authors and should not be interpreted as representing official policies, of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project. either expressed or implied, of the FreeBSD Project.
*/ */
$v = "v0.2"; // extension version $v = "v0.3"; // extension version
$appname = "OneButtonInstaller"; $appname = "OneButtonInstaller";
require_once("config.inc"); require_once("config.inc");

View File

@@ -1,4 +1,6 @@
Version Date Description 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 0.2 2016.08.09 N: configuration - enable/disable beta releases in extensions list
N: check hardware platform to use midnightcommander on i386 too N: check hardware platform to use midnightcommander on i386 too
F: disabling extension not possible, leads to an error message F: disabling extension not possible, leads to an error message

View File

@@ -1 +1 @@
0.2 0.3