From f0210c40c6b468abf88fdd0ae1f9a9aafb991795 Mon Sep 17 00:00:00 2001 From: crestAT Date: Thu, 28 Jan 2016 17:13:36 +0100 Subject: [PATCH] beta beta release 1 --- .../ext/ext/onebuttoninstaller/spinner.inc | 30 +++++ .../onebuttoninstaller-update_extension.php | 26 +---- onebuttoninstaller/ext/onebuttoninstaller.php | 104 ++++++------------ onebuttoninstaller/extensions.txt | 4 +- .../onebuttoninstaller-install.php | 12 +- onebuttoninstaller/version.txt | 2 +- onebuttoninstaller_install.php | 2 +- 7 files changed, 80 insertions(+), 100 deletions(-) create mode 100644 onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc diff --git a/onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc b/onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc new file mode 100644 index 0000000..1d88da8 --- /dev/null +++ b/onebuttoninstaller/ext/ext/onebuttoninstaller/spinner.inc @@ -0,0 +1,30 @@ + + +
+ + diff --git a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php b/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php index 01e769a..9d3d73b 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php +++ b/onebuttoninstaller/ext/onebuttoninstaller-update_extension.php @@ -126,29 +126,10 @@ if (isset($_POST['ext_update']) && $_POST['ext_update']) { else { $input_errors[] = sprintf(gettext("Download of installation file %s failed, installation aborted!"), "onebuttoninstaller-install.php"); } } include("fbegin.inc");?> - -
+ + +
@@ -196,4 +177,3 @@ function spinner() {
-
diff --git a/onebuttoninstaller/ext/onebuttoninstaller.php b/onebuttoninstaller/ext/onebuttoninstaller.php index f2a48c2..e9ceb27 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller.php +++ b/onebuttoninstaller/ext/onebuttoninstaller.php @@ -86,16 +86,9 @@ function log_display($loginfo) { * name: 0 extension name * version: 1 extension version (base for config entry - could change for newer versions) * xmlstring: 2 config.xml or installation directory - * command(list)1: 3 SHELL commands - * command(list)2: 4 PHP commands + * command(list)1: 3 execution of SHELL commands / scripts (e.g. download installer, untar, chmod, ...) + * command(list)2: 4 empty ("-") or PHP script name (file MUST exist) * description: 5 plain text which can include HTML tags - */ - -/* DEBUGGER -print_r($result[3]); -echo('
'); -print_r($result[4]); -echo('
'); */ // Create table data @@ -106,13 +99,14 @@ echo('
'); echo "\n"; for ($i = 0; $i < count($loginfo['columns']); $i++) { // handle pmids (columns) if ($i == count($loginfo['columns']) - 1) { - // check if extension is already installed (config.xml entry or for command line tools based on install directory) + // check if extension is already installed (existing config.xml entry or, for command line tools, based on installation directory) if ((isset($config[$result[2]])) || ((strpos($result[2], "/") == 0) && (is_dir("{$config['onebuttoninstaller']['storage_path']}{$result[2]}")))){ echo " \n"; } else { // data for installation echo " + \n"; @@ -125,74 +119,49 @@ echo('
'); } } -//ob_start(); -//$ausgabe = ob_get_contents(); -//ob_end_clean(); -//foreach ($ausgabe as $msg) $savemsg .= $msg."
"; -if (isset($_POST) && $_POST) { - foreach($_POST[name] as $line) { +if (isset($_POST['install'], $_POST['name'])) { + foreach($_POST['name'] as $line) { if (isset($line['extension'])) { - $savemsg .= "{$line['extension']}"."
"; - $savemsg .= print_r($line, true)."
"; + $savemsg .= gettext("Installation").": {$line['truename']}"."
"; unset($result); exec("cd {$config["onebuttoninstaller"]["storage_path"]} && {$line['command1']}", $result, $return_val); if ($return_val == 0) { - $savemsg .= "command1 successful"."
"; - foreach ($result as $msg) $savemsg .= $msg."
"; + foreach ($result as $msg) $savemsg .= $msg."
"; // output on success unset($result); -// exec("cd {$config["onebuttoninstaller"]["storage_path"]} && {$line['command2']}", $result, $return_val); -// if (file_exists("{$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']}")) { - if ("{$line['command2']}" != "-") { -ob_start(); - require_once("{$config['onebuttoninstaller']['storage_path']}/{$line['command2']}"); -ob_end_clean(); - if ($return_val == 0) { - $savemsg .= "
"."command2 successful"."
"; -// foreach ($result as $msg) $savemsg .= $msg."
"; - } - else { - $errormsg .= gettext("Error")."
"; -// foreach ($result as $msg) $errormsg .= $msg."
"; - $savemsg .= "command2 NOT successful"."
"; + if ("{$line['command2']}" != "-") { // check if a PHP script must be executed + if (file_exists("{$config["onebuttoninstaller"]["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']}"); + $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 .= "Error: file {$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']} not found!"."
"; - } - else { - $errormsg .= gettext("Error on command1")."
"; + } // EOcommand1 OK + else { // throw error message for command1 + $errormsg .= gettext("Installation error").": {$line['truename']}"."
"; foreach ($result as $msg) $errormsg .= $msg."
"; - $savemsg .= "command1 NOT successful"."
"; - } - } - } -} + } // EOcommand1 NOK + } // EOisset line + } // EOforeach +} // EOinstall -if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $savemsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt"); +if (isset($_POST['update'])) { + $return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}extensions.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/extensions.txt", true); + if ($return_val == 0) $savemsg .= gettext("New extensions list successfully downloaded!")."
"; + else $errormsg .= gettext("Unable to retrieve extensions list from server!")."
"; +} // EOupdate + +if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt")."
"; include("fbegin.inc");?> - -
+ + +
@@ -204,8 +173,8 @@ function spinner() {
- + - diff --git a/onebuttoninstaller/extensions.txt b/onebuttoninstaller/extensions.txt index d85f804..3159278 100644 --- a/onebuttoninstaller/extensions.txt +++ b/onebuttoninstaller/extensions.txt @@ -1,5 +1,5 @@ Extended GUI###0.5.1.2###extended-gui###mkdir -p extended-gui/backup && mkdir -p extended-gui/log && cd extended-gui && fetch https://raw.github.com/crestAT/nas4free-extended-gui/master/extended-gui/extended-gui-install.php && chmod 770 extended-gui*install.php && echo "fetch OK"###extended-gui/extended-gui-install.php###Extension for NAS4Free with several improvements for the WebGUI and additional functions. Most of the extension affects STATUS | SYSTEM view but also STATUS | GRAPH and DIAGNOSTICS | LOG which got a new entry NOTIFICATIONS.

The extension works on all plattforms (x86 & x64, ARM, embedded & full), does not need jail or pkg_add, enhance pages of the NAS4Free WebGUI, features configuration and extension maintenance (update & removal inside the WebGUI), let you switch between STANDARD (original) and EXTENDED WebGUI view and let you easily configure/enable/disable views and additional functions.
For more information -> NAS4Free Forum -Downloady###0.1###downloady###mkdir -p downloady/log && cd downloady && ls -hal && fetch -v https://raw.github.com/crestAT/nas4free-downloady/master/downloady/downloady-install.php && chmod 770 downloady*install.php && echo "fetch OK"###downloady/downloady-install.php###Simple PHP download manager which is fully integrated into the NAS4Free WebGUI.

Downloady for NAS4Free is based on Downloady - the PHP Download Manager by CyberLeo@cyberLeo Projects and features downloads from http, https and ftp sites as well as download bandwith managment, resume downloads after system startup and a simple scheduler. The extension works on all plattforms (x86 & x64, ARM, embedded & full), does not need jail or pkg_add, enhance pages of the NAS4Free WebGUI and features configuration and extension maintenance. +Downloady###0.1###downloady###mkdir -p downloady/log && cd downloady && fetch -v https://raw.github.com/crestAT/nas4free-downloady/master/downloady/downloady-install.php && chmod 770 downloady*install.php && echo "fetch OK"###downloady/downloady-install.php###Simple PHP download manager which is fully integrated into the NAS4Free WebGUI.

Downloady for NAS4Free is based on Downloady - the PHP Download Manager by CyberLeo@cyberLeo Projects and features downloads from http, https and ftp sites as well as download bandwith managment, resume downloads after system startup and a simple scheduler. The extension works on all plattforms (x86 & x64, ARM, embedded & full), does not need jail or pkg_add, enhance pages of the NAS4Free WebGUI and features configuration and extension maintenance. RRDGraphs###0.3.1###rrdgraphs###mkdir -p rrdgraphs && cd rrdgraphs && fetch https://raw.github.com/crestAT/nas4free-rrdtool/master/rrdgraphs/rrd-install.php && chmod 770 rrd*install.php && echo "fetch OK"###rrdgraphs/rrd-install.php###Extension to install / configure / update and remove RRDTool based graphs for NAS4Free servers.

The extension is based on RRDtool and provides graphs for CPU frequency, CPU temperature, CPU usage, Disk usage (recognition of all mountpoints/shares automatically at RRDG startup), Load averages, Memory usage, Network latency, Network traffic, Processes, UPS, Uptime and ZFS ARC.

The extension is compatible with all versions (9.1.x - 10.x) of NAS4Free except on ARM boxes and works on all plattforms (x86 & x64, embedded & full), does not need jail or pkg_add, add pages to NAS4Free Web GUI extensions, features configuration and extension maintenance (update & removal inside the WebGUI) and is able to work on RAM drives to take care of your HDDs/USB pen drives.
For more information -> NAS4Free Forum BitTorrent Sync###0.6.4.2###btsync###mkdir -p btsync && cd btsync && fetch https://raw.github.com/crestAT/nas4free-bittorrent-sync/master/bts-install.php && chmod 770 bts*install.php && echo "fetch OK"###btsync/bts-install.php###Extension to install / configure / backup / update / manage and remove BitTorrent Sync application on NAS4Free servers.

The extension can be used with BitTorrent Sync 1.4.x (last version was 1.4.111) as well as 2.x, is compatible with all versions (9.1.x - 10.x) of NAS4Free except on ARM boxes, works on all plattforms (embedded, full), does not need jail or pkg_add, add pages to NAS4Free Web GUI extensions, features configuration, application update & backup management, extension mantenance (update & removal) and log view with filter and search capability.

Note: Standard BitTorrent Sync version is based on 2.x releases, to use the latest 1.x release open Extensions | BitTorrent Sync | Maintenance and change the Download URL for version 1.4.111:
64 bit: http://syncapp.bittorrent.com/1.4.111/btsync_freebsd_x64-1.4.111.tar.gz
32 bit: http://syncapp.bittorrent.com/1.4.111/btsync_freebsd_i386-1.4.111.tar.gz
and hit Save URL, Fetch and Install.
For more information -> NAS4Free Forum Syncthing###0.1.3###syncthing###mkdir -p syncthing && cd syncthing && fetch https://raw.github.com/crestAT/nas4free-syncthing/master/stg-install.php && chmod 770 stg*install.php && echo "fetch OK"###syncthing/stg-install.php###Extension to install / configure / backup / update / manage and remove Syncthing (STG) application on NAS4Free (N4F) servers.

The extension works on all plattforms, does not need jail or pkg_add, add pages to NAS4Free WebGUI extensions, features configuration, application update & backup management, scheduling and log view with filter / search capabilities.
For more information -> NAS4Free Forum @@ -10,4 +10,4 @@ DNSMasq DHCP Server###0.2###dnsmasq###mkdir -p dnsmasq && cd dnsmasq && fetch ht Midnight Commander###2015-02-21###/midnightcommander###mkdir -p midnightcommander && cd midnightcommander && cp /usr/local/www/ext/onebuttoninstaller/mcommander.sh . && echo "copy OK" && chmod u+x mcommander.sh && echo "chmod OK" && `pwd`/mcommander.sh###-###Midnight Commander for NAS4Free.

After the successful installation you can use Midnight Commander in the system console shell or if you connect via ssh. To start the Midnight Commander just enter the command mc in the CLI.
For more information -> NAS4Free Forum zzz Dummy Project1###1.0###DummyProject###fetch https://raw.github.com/crestAT/nas4free-extended-gui/master/extended-gui_install.php && chmod 770 extended-gui*install.php && echo "fetch OK"###cat TEST/release_notes.txt && echo "\nFERTIG bin ich\n" && chmod 770 TEST/test.sh && TEST/test.sh###This is a testbed for NAS4Free extensions!!!
Note: Don't use this extension!!! zzz WebGUI Themes###6.6###themes###command1 themes ### command2 themes ### blah blah blah blah blah -zzz RSS Feeder###x.y.z###rssfeed###command1 rssfeed ### command2 rssfeed ### blah blah blah blah blah +zzz RSS Feeder###x.y.z###rssfeed###echo "rssfeed com1" && echo "rssfeed OK"###zzz.php### blah blah blah blah blah diff --git a/onebuttoninstaller/onebuttoninstaller-install.php b/onebuttoninstaller/onebuttoninstaller-install.php index a868abc..3cbb34f 100644 --- a/onebuttoninstaller/onebuttoninstaller-install.php +++ b/onebuttoninstaller/onebuttoninstaller-install.php @@ -31,11 +31,14 @@ */ /* Version Date Description +0.1-b1 2016.01.28 real install/update from GitHub +0.1-a6 2016.01.28 include spinner with overlay +0.1-a5 2016.01.27 output buffering working now 0.1-a4 2016.01.25 initial release 0.1-a1 2016.01.16 initial release */ -$v = "0.1-a4"; // extension version +$v = "0.1-b1"; // extension version $appname = "OneButtonInstaller"; require_once("config.inc"); @@ -50,7 +53,6 @@ global $input_errors; global $savemsg; $install_dir = dirname(__FILE__)."/"; // get directory where the installer script resides -if (!is_dir("{$install_dir}/backup")) { mkdir("{$install_dir}/backup", 0775, true); } if (!is_dir("{$install_dir}/log")) { mkdir("{$install_dir}/log", 0775, true); } // check FreeBSD release for fetch options >= 9.3 @@ -60,11 +62,11 @@ else $verify_hostname = ""; // create stripped version name $vs = str_replace(".", "", $v); // fetch release archive -$return_val = 0;//mwexec("fetch {$verify_hostname} -vo {$install_dir}master.zip 'https://github.com/crestAT/nas4free-onebuttoninstaller/releases/download/{$v}/onebuttoninstaller-{$vs}.zip'", true); +$return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}master.zip 'https://github.com/crestAT/nas4free-onebuttoninstaller/releases/download/{$v}/onebuttoninstaller-{$vs}.zip'", true); if ($return_val == 0) { - $return_val = 0;//mwexec("tar -xf {$install_dir}master.zip -C {$install_dir} --exclude='.git*' --strip-components 2", true); + $return_val = mwexec("tar -xf {$install_dir}master.zip -C {$install_dir} --exclude='.git*' --strip-components 2", true); if ($return_val == 0) { -// exec("rm {$install_dir}master.zip"); + exec("rm {$install_dir}master.zip"); exec("chmod -R 775 {$install_dir}"); if (is_file("{$install_dir}version.txt")) { $file_version = exec("cat {$install_dir}version.txt"); } else { $file_version = "n/a"; } diff --git a/onebuttoninstaller/version.txt b/onebuttoninstaller/version.txt index 9a50c30..03d5e5c 100644 --- a/onebuttoninstaller/version.txt +++ b/onebuttoninstaller/version.txt @@ -1 +1 @@ -0.1-a4 +0.1-b1 diff --git a/onebuttoninstaller_install.php b/onebuttoninstaller_install.php index d34af41..af7ba25 100644 --- a/onebuttoninstaller_install.php +++ b/onebuttoninstaller_install.php @@ -7,7 +7,7 @@ $release = explode("-", exec("uname -r")); if ($release[0] >= 9.3) $verify_hostname = "--no-verify-hostname"; else $verify_hostname = ""; -$return_val = 0;//mwexec("fetch {$verify_hostname} -vo onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); +$return_val = mwexec("fetch {$verify_hostname} -vo onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); if ($return_val == 0) { chmod("onebuttoninstaller/onebuttoninstaller-install.php", 0775); require_once("onebuttoninstaller/onebuttoninstaller-install.php");