diff --git a/LICENSE.txt b/LICENSE.txt index 8944d5f..a23e24e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2015 - 2017 Andreas Schmidhuber, aka crest(AT) +Copyright (c) 2015 - 2018 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/OBI.php b/OBI.php index c4182a4..a66813a 100644 --- a/OBI.php +++ b/OBI.php @@ -2,7 +2,7 @@ /* OBI.php - Copyright (c) 2015 - 2016 Andreas Schmidhuber + Copyright (c) 2015 - 2018 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -24,10 +24,6 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. */ require("auth.inc"); require("guiconfig.inc"); @@ -37,6 +33,10 @@ if (!isset($config['onebuttoninstaller']) || !is_array($config['onebuttoninstaller'])) $config['onebuttoninstaller'] = array(); +$platform = $g['platform']; +if ($platform == "livecd" || $platform == "liveusb") + $input_errors[] = sprintf(gettext("Attention: the used XigmaNAS platform '%s' is not recommended for extensions! After a reboot all extensions will no longer be available, use XigmaNAS embedded or full platform instead!"), $platform); + /* Check if the directory exists, the mountpoint has at least o=rx permissions and * set the permission to 775 for the last directory in the path */ @@ -85,7 +85,7 @@ function change_perms($dir) { $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); + $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'", false); if ($return_val == 0) { chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); diff --git a/README.md b/README.md index 5b1ee18..c803f78 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ OneButtonInstaller ------------------ -Description in the NAS4Free forum -> OneButtonInstaller - +Please visit the XigmaNAS forum for full description and installation guide -> OneButtonInstaller diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit b/onebuttoninstaller/apps/fail2ban.postinit similarity index 90% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit rename to onebuttoninstaller/apps/fail2ban.postinit index 062392b..642fc17 100644 --- a/onebuttoninstaller/ext/ext/onebuttoninstaller/fail2ban.postinit +++ b/onebuttoninstaller/apps/fail2ban.postinit @@ -2,7 +2,7 @@ /* fail2ban.postinit - Copyright (c) 2015 - 2017 Andreas Schmidhuber + Copyright (c) 2015 - 2018 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -24,10 +24,6 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. */ $command = "fail2ban_start.sh"; diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit b/onebuttoninstaller/apps/mcommander.postinit similarity index 86% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit rename to onebuttoninstaller/apps/mcommander.postinit index e296ced..0c3a8c5 100644 --- a/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.postinit +++ b/onebuttoninstaller/apps/mcommander.postinit @@ -1,8 +1,8 @@ = 11.0) { // new rc format // postinit command $rc_param = []; $rc_param['uuid'] = uuid(); - $rc_param['name'] = "MidnightCommander Extension"; + $rc_param['name'] = "{$appName} Extension"; $rc_param['value'] = "{$cmd}"; - $rc_param['comment'] = "Start MidnightCommander"; + $rc_param['comment'] = "Start {$appName}"; $rc_param['typeid'] = '2'; $rc_param['enable'] = true; $config['rc']['param'][] = $rc_param; diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.sh b/onebuttoninstaller/apps/mcommander.sh similarity index 100% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/mcommander.sh rename to onebuttoninstaller/apps/mcommander.sh diff --git a/onebuttoninstaller/apps/ncdu.postinit b/onebuttoninstaller/apps/ncdu.postinit new file mode 100644 index 0000000..17c8be0 --- /dev/null +++ b/onebuttoninstaller/apps/ncdu.postinit @@ -0,0 +1,69 @@ += 11.0) { // new rc format + // postinit command + $rc_param = []; + $rc_param['uuid'] = uuid(); + $rc_param['name'] = "{$appName} Extension"; + $rc_param['value'] = "{$cmd}"; + $rc_param['comment'] = "Start {$appName}"; + $rc_param['typeid'] = '2'; + $rc_param['enable'] = true; + $config['rc']['param'][] = $rc_param; +} +else { + $config['rc']['postinit']['cmd'][] = "{$cmd}"; +} +write_config(); +?> diff --git a/onebuttoninstaller/apps/ncdu.sh b/onebuttoninstaller/apps/ncdu.sh new file mode 100644 index 0000000..f4e7e3b --- /dev/null +++ b/onebuttoninstaller/apps/ncdu.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# filename: ncdu.sh +# author: Graham Inggs +# date: 2018-05-24 ; Initial release for NAS4Free 11.1.0.4 +# purpose: Install NCurses Disk Usage (ncdu) on NAS4Free (embedded version). +# Note: Check the end of the page. +# +#----------------------- Set variables ------------------------------------------------------------------ +DIR=`dirname $0`; +PLATFORM=`uname -m` +RELEASE=`uname -r | cut -d- -f1` +REL_MAJOR=`echo $RELEASE | cut -d. -f1` +REL_MINOR=`echo $RELEASE | cut -d. -f2` +#URL="http://distcache.freebsd.org/FreeBSD:${REL_MAJOR}:${PLATFORM}/release_${REL_MINOR}/All" +URL="http://distcache.freebsd.org/FreeBSD:${REL_MAJOR}:${PLATFORM}/release_1/All" +NCDUFILE="ncdu-1.12.txz" +#----------------------- Set Errors --------------------------------------------------------------------- +_msg() { case $@ in + 0) echo "The script will exit now."; exit 0 ;; + 1) echo "No route to server, or file do not exist on server"; _msg 0 ;; + 2) echo "Can't find ${FILE} on ${DIR}"; _msg 0 ;; + 3) echo "NCurses Disk Usage installed and ready! (ONLY USE DURING A SSH SESSION)"; exit 0 ;; + 4) echo "Always run this script using the full path: /mnt/.../directory/ncdu.sh"; _msg 0 ;; +esac ; exit 0; } +#----------------------- Check for full path ------------------------------------------------------------ +if [ ! `echo $0 |cut -c1-5` = "/mnt/" ]; then _msg 4; fi +cd $DIR; +#----------------------- Download and decompress ncdu files if needed ----------------------------------- +FILE=${NCDUFILE} +if [ ! -d ${DIR}/usr/local/bin ]; then + if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi + if [ -f ${DIR}/${FILE} ]; then tar xzf ${DIR}/${FILE} || _msg 2; + rm ${DIR}/+*; rm -R ${DIR}/usr/local/man; rm -R ${DIR}/usr/local/share; fi + if [ ! -d ${DIR}/usr/local/bin ] ; then _msg 4; fi +fi +#----------------------- Create symlinks ---------------------------------------------------------------- +for i in `ls $DIR/usr/local/bin/` + do if [ ! -e /usr/local/bin/${i} ]; then ln -s ${DIR}/usr/local/bin/$i /usr/local/bin; fi; done +_msg 3 ; exit 0; +#----------------------- End of Script ------------------------------------------------------------------ +# 1. Keep this script in its own directory. +# 2. chmod the script u+x, +# 3. Always run this script using the full path: /mnt/.../directory/ncdu.sh +# 4. You can add this script to WebGUI: Advanced: Command Scripts as a PostInit command (see 3). +# 5. To run Ncurses Disk Usage from shell type 'ncdu'. diff --git a/onebuttoninstaller/ext/extension-lib.inc b/onebuttoninstaller/ext/extension-lib.inc new file mode 100644 index 0000000..344f9c5 --- /dev/null +++ b/onebuttoninstaller/ext/extension-lib.inc @@ -0,0 +1,208 @@ + 10.3032853, 11.0 + * return: + * true => current release >= minimal release + * false => current release < minimal release +*/ +if (!function_exists('ext_check_release')) { + function ext_check_release($min_release) { + global $config; + $product_version = explode(".", get_product_version()); // p.version = 10.3.0.3, p.revision = 2853 + $current_release = $product_version[0].".".$product_version[1].$product_version[2].$product_version[3].get_product_revision(); + if ($current_release < floatval($min_release)) return false; // release not supported + else return true; // release supported + } +} + +/* function ext_create_rc_commands + * params: + * $appname: extension name + * $postinit: postinit command + * $shutdown: shutdown command + * $start_action: comment e.g. Start, Run, Initialize + * $stop_action: comment e.g. Stop, Closedown + * return: + * $postinit: uuid or false + * $shutdown: uuid or false +*/ +if (!function_exists('ext_create_rc_commands')) { + function ext_create_rc_commands($appname, &$postinit = false, &$shutdown = false, $start_action = "Start", $stop_action = "Stop") { + global $config; + if (ext_check_release(11.0)) { // new rc format + unset($rc_param); + // postinit command + if (($postinit !== false) && !empty($postinit)) { + $rc_param = []; + $rc_param['uuid'] = uuid(); + $rc_param['name'] = "{$appname} Extension"; + $rc_param['value'] = $postinit; + $rc_param['comment'] = "{$start_action} {$appname}"; + $rc_param['typeid'] = '2'; + $rc_param['enable'] = true; + if (!is_array($config['rc'])) $config['rc'] = []; + if (!is_array($config['rc']['param'])) $config['rc']['param'] = []; + $config['rc']['param'][] = $rc_param; + $postinit = $rc_param['uuid']; + unset($rc_param); + } + // shutdown command + if (($shutdown !== false) && !empty($shutdown)) { + $rc_param = []; + $rc_param['uuid'] = uuid(); + $rc_param['name'] = "{$appname} Extension"; + $rc_param['value'] = $shutdown; + $rc_param['comment'] = "{$stop_action} {$appname}"; + $rc_param['typeid'] = '3'; + $rc_param['enable'] = true; + if (!is_array($config['rc'])) $config['rc'] = []; + if (!is_array($config['rc']['param'])) $config['rc']['param'] = []; + $config['rc']['param'][] = $rc_param; + $shutdown = $rc_param['uuid']; + unset($rc_param); + } + } + else { + if (($postinit !== false) && !empty($postinit)) { + $config['rc']['postinit']['cmd'][] = $postinit; + $postinit = false; + } + if (($shutdown !== false) && !empty($shutdown)) { + $config['rc']['shutdown']['cmd'][] = $shutdown; + $shutdown = false; + } + } + write_config(); + } +} + +/* function ext_remove_rc_commands + * remove postinit / shutdown commands from rc array for both NAS4Free < 11.x and >= 11.x series + * params: + * $config_name: string to identify the rc command entry in rc|postinit/shutdown|cmd or rc|param|value +*/ +if (!function_exists('ext_remove_rc_commands')) { + function ext_remove_rc_commands($config_name) { + global $config; + // remove existing old rc format entries + if (is_array($config['rc']) && is_array($config['rc']['postinit']) && is_array( $config['rc']['postinit']['cmd'])) { + $rc_param_count = count($config['rc']['postinit']['cmd']); + for ($i = 0; $i < $rc_param_count; $i++) { + if (preg_match("/{$config_name}/", $config['rc']['postinit']['cmd'][$i])) unset($config['rc']['postinit']['cmd'][$i]); + } + } + if (is_array($config['rc']) && is_array($config['rc']['shutdown']) && is_array( $config['rc']['shutdown']['cmd'])) { + $rc_param_count = count($config['rc']['shutdown']['cmd']); + for ($i = 0; $i < $rc_param_count; $i++) { + if (preg_match("/{$config_name}/", $config['rc']['shutdown']['cmd'][$i])) unset($config['rc']['shutdown']['cmd'][$i]); + } + } + // remove existing entries for new rc format + if (is_array($config['rc']) && is_array($config['rc']['param']['0'])) { + $rc_param_count = count($config['rc']['param']); + for ($i = 0; $i < $rc_param_count; $i++) { + if (preg_match("/{$config_name}/", $config['rc']['param'][$i]['value'])) unset($config['rc']['param'][$i]); + } + } + write_config(); + } +} + +/* function ext_check_version + * checks an extension if a new version exists against the currently installed version + * params: + * $test_filename: filename including the full path which holds the version number + * $extension_name: extension name in URL format to retrive from Github + * $current_version: string of current installed version + * $button_name: gettext("name") to create a note for user action, e.g. Maintenance, Update + * return: + * empty: no new version found + * or string: message for user action on new version found + * or false: Github version could not be retrieved +*/ +if (!function_exists('ext_check_version')) { + function ext_check_version($test_filename, $extension_name, $current_version, $button_name) { + global $config; + if (!is_file($test_filename) || filemtime($test_filename) < time() - 86400) { // test if file exists or is older than 24 hours + $return_val = mwexec("fetch -o {$test_filename} https://raw.github.com/crestAT/nas4free-{$extension_name}/master/{$extension_name}/version.txt", false); + if ($return_val == 0) { + $server_version = exec("cat {$test_filename}"); + if ($server_version != $current_version) return sprintf(gettext("New extension version %s available, push '%s' button to install the new version!"), $server_version, $button_name)."
"; + } + else return false; + } + } +} + +/* function ext_load_config + * loads a json formatted array from a standalone file + * params: + * $config_file: config file including full path + * return: + * data array: json formatted array + * or false: config file not found or content not retrievable +*/ +if (!function_exists('ext_load_config')) { + function ext_load_config($config_file, $assoc = true, $depth = 512, $options = 0) { + if (is_file($config_file)) { + if (($config_data = file_get_contents($config_file)) === false) return false; + $config_data = utf8_encode($config_data); + $config_data = json_decode($config_data, $assoc, $depth, $options); + return $config_data; + } + else return false; + } +} + +/* function ext_save_config + * loads a json formatted array from a standalone file + * params: + * $config_file: config file including full path + * $config_data: php array with configuration data + * return: + * error condition + */ +if (!function_exists('ext_save_config')) { + function ext_save_config($config_file, $config_data){ + header("Content-Type: application/json; UTF-8\n"); + file_put_contents($config_file, json_encode($config_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES )); + return json_last_error(); + } +} +?> diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/menu.inc b/onebuttoninstaller/ext/menu.inc similarity index 100% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/menu.inc rename to onebuttoninstaller/ext/menu.inc diff --git a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php b/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php deleted file mode 100644 index 17f5270..0000000 --- a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - -
- - - -
-
    - -
  • -
  • -
  • - -
  • -
  • - -
-
- - - - - - - -
-
- Please note: this page will no longer be available. You'll have to re-run OneButtonInstaller extension installation to get it back on your NAS4Free."));?> -
- " onclick="return confirm('')" /> - " onclick="return confirm('')" /> -
- - - - - - - -
-
- -
-
- -
-
- diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/spin.min.js b/onebuttoninstaller/ext/spin.min.js similarity index 100% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/spin.min.js rename to onebuttoninstaller/ext/spin.min.js diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc b/onebuttoninstaller/ext/spinner.inc similarity index 98% rename from onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc rename to onebuttoninstaller/ext/spinner.inc index 7075c59..dd5ae97 100644 --- a/onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc +++ b/onebuttoninstaller/ext/spinner.inc @@ -1,7 +1,7 @@ + + + + +
+ + + +
+
    + +
  • + +
  • +
  • +
+
+ + + + + + + +
+
+ Please note: this page will no longer be available. You'll have to re-run {$configuration['appname']} extension installation to get it back on your NAS4Free."));?> +
+ " onclick="return confirm('')" /> + " onclick="return confirm('')" /> +
+ + + + + + + +
+
+ +
+
+ +
+
+ diff --git a/onebuttoninstaller/ext/onebuttoninstaller.php b/onebuttoninstaller/onebuttoninstaller.php similarity index 71% rename from onebuttoninstaller/ext/onebuttoninstaller.php rename to onebuttoninstaller/onebuttoninstaller.php index 7b9e5af..8228382 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller.php +++ b/onebuttoninstaller/onebuttoninstaller.php @@ -2,7 +2,7 @@ /* onebuttoninstaller.php - Copyright (c) 2015 - 2017 Andreas Schmidhuber + Copyright (c) 2015 - 2018 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -24,27 +24,44 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. */ +require("auth.inc"); +require("guiconfig.inc"); + if (is_file("/usr/local/www/bar_left.gif")) $image_path = ''; else $image_path = 'images/'; -require("auth.inc"); -require("guiconfig.inc"); -if (!isset($config['onebuttoninstaller']['enable'])) header("Location:onebuttoninstaller-config.php"); +$configName = "onebuttoninstaller"; +$configFile = "ext/{$configName}/{$configName}.conf"; +require_once("ext/{$configName}/extension-lib.inc"); + +$domain = strtolower(get_product_name()); +$localeOSDirectory = "/usr/local/share/locale"; +$localeExtDirectory = "/usr/local/share/locale-{$configName}"; +bindtextdomain($domain, $localeExtDirectory); + +if (($configuration = ext_load_config($configFile)) === false) $input_errors[] = sprintf(gettext("Configuration file %s not found!"), "{$configName}.conf"); +if (!isset($configuration['rootfolder']) && !is_dir($configuration['rootfolder'] )) $input_errors[] = gettext("Extension installed with fault"); + +if (!$configuration['enable']) header("Location:onebuttoninstaller-config.php"); -bindtextdomain("nas4free", "/usr/local/share/locale-obi"); -$pgtitle = array(gettext("Extensions"), gettext("OneButtonInstaller")." ".$config['onebuttoninstaller']['version']); +$platform = $g['platform']; +if ($platform == "livecd" || $platform == "liveusb") + $input_errors[] = sprintf(gettext("Attention: the used XigmaNAS platform '%s' is not recommended for extensions! After a reboot all extensions will no longer be available, use XigmaNAS embedded or full platform instead!"), $platform); + +$pgtitle = array(gettext("Extensions"), $configuration['appname']." ".$configuration['version']); + +$pingServer = "github.com"; +$pingReturnVal = mwexec("ping -c1 {$pingServer}", true); +if ($pingReturnVal != 0) $input_errors[] = sprintf(gettext("Internet connection or the server '%s' is not available, please check your DNS settings under %s > %s | %s. + Currently the first IPv4 DNS server address is set to '%s'"), $pingServer, gettext("System"), gettext("General Setup"), gettext("DNS"), $config['system']['dnsserver'][0]); $log = 0; $loginfo = array( array( "visible" => TRUE, "desc" => gettext("Extensions"), - "logfile" => "{$config['onebuttoninstaller']['rootfolder']}extensions.txt", + "logfile" => "{$configuration['rootfolder']}/extensions.txt", "filename" => "extensions.txt", "type" => "plain", "pattern" => "/^(.*)###(.*)###(.*)###(.*)###(.*)###(.*)###(.*)$/", @@ -109,10 +126,7 @@ function log_get_status($cmd_entry) { } function log_display($loginfo) { - global $g; - global $config; - global $savemsg; - global $image_path; + global $g, $config, $configuration, $savemsg, $image_path; if (!is_array($loginfo)) return; @@ -149,7 +163,7 @@ function log_display($loginfo) { if ((FALSE === $result) || (0 == $result)) continue; echo "\n"; for ($i = 0; $i < count($loginfo['columns']); $i++) { // handle pmids (columns) - if (!isset($config['onebuttoninstaller']['show_beta']) && (strpos($result[1], "RELEASE") === false)) continue; //check for beta state + if (!$configuration['show_beta'] && (strpos($result[1], "RELEASE") === false)) continue; //check for beta state else { if ($i == count($loginfo['columns']) - 1) { if (!empty($result[6])) { // something unsupported exist @@ -168,7 +182,7 @@ function log_display($loginfo) { echo "> @@ -185,26 +199,43 @@ function log_display($loginfo) { } } +if (isset($_POST['cleanup'], $_POST['name'])) { + foreach($_POST['name'] as $line) { + if (isset($line['extension'])) { + ext_remove_rc_commands($line['extension']); // remove entry from command scripts + unset($config[$line['extension']]); // remove entry from config.xml + if ($line['extension'] == "plexinit") $line['extension'] = "plex-gui"; // special treatment for plex gui + if (file_exists("/usr/local/www/ext/{$line['extension']}/menu.inc")) + unlink("/usr/local/www/ext/{$line['extension']}/menu.inc"); // remove entry from extensions menu + write_config(); + $savemsg .= gettext("Cleanup").": {$line['truename']} ({$line['extension']})"."
"; + } + } +} + if (isset($_POST['install'], $_POST['name'])) { foreach($_POST['name'] as $line) { if (isset($line['extension'])) { + ext_remove_rc_commands($line['extension']); // to force correct command script entries in case of recovered/changed config/directories for extensions + unset($config[$line['extension']]); + write_config(); $savemsg .= gettext("Installation").": {$line['truename']}"."
"; unset($result); - exec("cd {$config["onebuttoninstaller"]["storage_path"]} && {$line['command1']}", $result, $return_val); + exec("cd {$configuration['storage_path']} && {$line['command1']}", $result, $return_val); if ($return_val == 0) { foreach ($result as $msg) $savemsg .= $msg."
"; // output on success unset($result); if ("{$line['command2']}" != "-") { // check if a PHP script must be executed - if (file_exists("{$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']}")) { + if (file_exists("{$configuration['storage_path']}/{$line['command2']}")) { $savemsg_old = $savemsg; // save messages for use after output buffering ends ob_start(); // start output buffering - include("{$config['onebuttoninstaller']['storage_path']}/{$line['command2']}"); + include("{$configuration['storage_path']}/{$line['command2']}"); $ausgabe = ob_get_contents(); // get outputs from include command ob_end_clean(); // close output buffering $savemsg = $savemsg_old; // recover saved messages ... $savemsg .= str_replace("\n", "
", $ausgabe)."
"; // ... and append messages from include command } - else $errormsg .= sprintf(gettext("PHP script %s not found!"), "{$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']}")."
"; + else $errormsg .= sprintf(gettext("PHP script %s not found!"), "{$configuration['storage_path']}/{$line['command2']}")."
"; } } // EOcommand1 OK else { // throw error message for command1 @@ -215,24 +246,21 @@ function log_display($loginfo) { } // EOforeach } // EOinstall -if (isset($_POST['update']) || (isset($config['onebuttoninstaller']['auto_update']) && !isset($_POST['install']))) { - $return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}extensions.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/extensions.txt", true); +// extensions list file handling for => manual update | auto update | missing file | file older than 24 hours +if (isset($_POST['update']) || ($configuration['auto_update'] && !isset($_POST['install'])) || !is_file("{$configuration['rootfolder']}/extensions.txt") || filemtime("{$configuration['rootfolder']}/extensions.txt") < time() - 86400) { + $return_val = mwexec("fetch -o {$configuration['rootfolder']}/extensions.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/extensions.txt", false); if ($return_val == 0) $savemsg .= gettext("New extensions list successfully downloaded!")."
"; 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, push '%s' button to install the new version!"), $server_version, gettext("Maintenance")); } -} //EOversion-check +if (($message = ext_check_version("{$configuration['rootfolder']}/version_server.txt", "onebuttoninstaller", $configuration['version'], gettext("Maintenance"))) !== false) $savemsg .= $message; -if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt")."
"; -if (isset($config['onebuttoninstaller']['re_install'])) $savemsg .= sprintf(gettext("Option '%s' in '%s' is enabled!"), gettext("Re-install"), gettext("Configuration")); +if (!is_file("{$configuration['rootfolder']}/extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$configuration['rootfolder']}/extensions.txt")."
"; -bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language +bindtextdomain($domain, $localeOSDirectory); include("fbegin.inc"); -bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?> +bindtextdomain($domain, $localeExtDirectory); +?> @@ -248,8 +276,14 @@ function log_display($loginfo) { + + ".sprintf(gettext("Option '%s' in '%s' is enabled!"), gettext("Re-install"), gettext("Configuration")).""; + if ($configuration['show_beta']) $remarkmsg .= "
  • ".sprintf(gettext("Option '%s' in '%s' is enabled!"), gettext("Beta releases"), gettext("Configuration"))."
  • "; + html_remark("storage_path", gettext("Common directory")." - {$configuration['storage_path']}", $remarkmsg); + ?>
    " value="" onclick="return confirm('')" /> + + " value="" onclick="return confirm('')" /> + " value="" />
    diff --git a/onebuttoninstaller/release_notes.txt b/onebuttoninstaller/release_notes.txt index 668ae8c..092049c 100644 --- a/onebuttoninstaller/release_notes.txt +++ b/onebuttoninstaller/release_notes.txt @@ -1,4 +1,13 @@ Version Date Description +0.4 2018.08.15 N: Ncurses Disk Usage (ncdu) shell app + N: use dedicated config file + N: check and warn if on LiveUSB/LiveCD + N: check for working internet connection + N: cleanup button on install page - usable in conjunction with the option 'Re-install' to only perform a cleanup + without new installation of extensions + C: improvements for option 'Re-install', cleanup of config and command scripts prior to the installation process + F: GUI translations not working due to name change to XigmaNAS + 0.3.4.1 2017.02.17 F: installation fails on vanilla systems => http://forums.nas4free.org/viewtopic.php?f=71&t=11189&p=75515#p75357 0.3.4 2016.11.23 N: command scripts rc format for NAS4Free 11.x compatibility diff --git a/onebuttoninstaller/version.txt b/onebuttoninstaller/version.txt index 8a19d8d..e6adf3f 100644 --- a/onebuttoninstaller/version.txt +++ b/onebuttoninstaller/version.txt @@ -1 +1 @@ -0.3.4.1 +0.4 \ No newline at end of file