forked from Mirrors/nas4free-onebuttoninstaller
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f8c2385f0 | ||
|
|
db32583c34 | ||
|
|
061867ff8b |
8
OBI.php
8
OBI.php
@@ -76,12 +76,13 @@ 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 (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!");
|
||||
}
|
||||
else {
|
||||
if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true);
|
||||
change_perms($config['onebuttoninstaller']['storage_path']);
|
||||
$config['onebuttoninstaller']['path_check'] = isset($_POST['path_check']) ? true : false;
|
||||
$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);
|
||||
@@ -91,7 +92,7 @@ if (isset($_POST['save']) && $_POST['save']) {
|
||||
}
|
||||
else {
|
||||
$input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php");
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
mwexec("rm -Rf ext/OBI; rm -f OBI.php", true);
|
||||
header("Location:onebuttoninstaller-config.php");
|
||||
@@ -107,6 +108,7 @@ if (isset($_POST['cancel']) && $_POST['cancel']) {
|
||||
}
|
||||
|
||||
$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;
|
||||
|
||||
include("fbegin.inc"); ?>
|
||||
<form action="OBI.php" method="post" name="iform" id="iform">
|
||||
@@ -117,7 +119,7 @@ include("fbegin.inc"); ?>
|
||||
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
||||
<?php html_titleline($application);?>
|
||||
<?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);?>
|
||||
</table>
|
||||
<?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/)."), "<b><font color='red'>".gettext("Please use this option only if you know what you are doing!")."</font></b>", false);?> </table>
|
||||
<div id="submit">
|
||||
<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>"/>
|
||||
<input id="cancel" name="cancel" type="submit" class="formbtn" value="<?=gettext("Cancel");?>"/>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -83,26 +83,35 @@ 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 <b>'/mnt/'</b> 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());
|
||||
$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())." ";
|
||||
} // end of empty input_errors
|
||||
}
|
||||
|
||||
$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, push '%s' button 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) {
|
||||
<?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_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/)."), "<b><font color='red'>".gettext("Please use this option only if you know what you are doing!")."</font></b>", 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);?>
|
||||
</table>
|
||||
|
||||
@@ -40,7 +40,7 @@ if (is_file("{$config['onebuttoninstaller']['rootfolder']}log/oneload")) { requi
|
||||
$return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}log/version.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/version.txt", true);
|
||||
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, push '%s' button to install the new version!"), $server_version, gettext("Update Extension")); }
|
||||
if ($server_version != $config['onebuttoninstaller']['version']) { $savemsg .= sprintf(gettext("New extension version %s available, push '%s' button to install the new version!"), $server_version, gettext("Update Extension")); }
|
||||
mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}release_notes.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/release_notes.txt", false);
|
||||
}
|
||||
else { $server_version = gettext("Unable to retrieve version from server!"); }
|
||||
@@ -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
|
||||
|
||||
@@ -208,6 +208,12 @@ if (isset($_POST['update']) || (isset($config['onebuttoninstaller']['auto_update
|
||||
else $errormsg .= gettext("Unable to retrieve extensions list from server!")."<br />";
|
||||
} // 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, push '%s' button 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 />";
|
||||
|
||||
bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
c143308bd6f18d8d4c42c1daaab553cb1eeadca1e89db29909b93dfb80b0dc69ed5ea3e5cc91813f3598a9edf414750a101e2a0449d945eedeb448f1252a6132
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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.1"; // extension version
|
||||
$appname = "OneButtonInstaller";
|
||||
|
||||
require_once("config.inc");
|
||||
|
||||
@@ -32,5 +32,5 @@
|
||||
$extension_dir = "/usr/local/www";
|
||||
mwexec("rm -Rf {$extension_dir}/onebuttoninstaller*", true);
|
||||
mwexec("rm -Rf {$extension_dir}/ext/onebuttoninstaller", true);
|
||||
exec("logger onebuttoninstaller: stopped");
|
||||
exec("logger onebuttoninstaller: stopped");
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/local/bin/php-cgi -f
|
||||
<?php
|
||||
require_once("config.inc");
|
||||
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php");
|
||||
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php");
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/local/bin/php-cgi -f
|
||||
<?php
|
||||
require_once("config.inc");
|
||||
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-stop.php");
|
||||
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-stop.php");
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Version Date Description
|
||||
0.3.1 2016.08.15 F: OBI installer - add checkbox to override restriction for extensions installation path
|
||||
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
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.2
|
||||
0.3.1
|
||||
|
||||
Reference in New Issue
Block a user