diff --git a/OBI.php b/OBI.php new file mode 100644 index 0000000..59b05ee --- /dev/null +++ b/OBI.php @@ -0,0 +1,124 @@ + 1) { + if (!is_dir($path)) { // check if directory exists + $input_errors[] = sprintf(gettext("Directory %s doesn't exist!"), $path); + } + else { + $path_check = explode("/", $path); // split path to get directory names + $path_elements = count($path_check); // get path depth + $fp = substr(sprintf('%o', fileperms("/$path_check[1]/$path_check[2]")), -1); // get mountpoint permissions for others + if ($fp >= 5) { // transmission needs at least read & search permission at the mountpoint + $directory = "/$path_check[1]/$path_check[2]"; // set to the mountpoint + for ($i = 3; $i < $path_elements - 1; $i++) { // traverse the path and set permissions to rx + $directory = $directory."/$path_check[$i]"; // add next level + exec("chmod o=+r+x \"$directory\""); // set permissions to o=+r+x + } + $path_elements = $path_elements - 1; + $directory = $directory."/$path_check[$path_elements]"; // add last level + exec("chmod 775 {$directory}"); // set permissions to 775 + exec("chown {$_POST['who']} {$directory}*"); + } + else + { + $input_errors[] = sprintf(gettext("%s needs at least read & execute permissions at the mount point for directory %s! Set the Read and Execute bits for Others (Access Restrictions | Mode) for the mount point %s (in Disks | Mount Point | Management or Disks | ZFS | Datasets) and hit Save in order to take them effect."), $application, $path, "/{$path_check[1]}/{$path_check[2]}"); + } + } + } +} + +if (isset($_POST['save']) && $_POST['save']) { + unset($input_errors); + 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 (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); + change_perms($config['onebuttoninstaller']['storage_path']); + $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); + if ($return_val == 0) { + chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); + require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + } + else { + $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + exit; + } + mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); + header("Location:onebuttoninstaller-config.php"); + } +} + +if (isset($_POST['cancel']) && $_POST['cancel']) { + $return_val = mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); + if ($return_val == 0) { $savemsg .= $application." ".gettext("not installed"); } + else { $input_errors[] = $application." removal failed"; } + header("Location:index.php"); +} + +$pconfig['storage_path'] = !empty($config['onebuttoninstaller']['storage_path']) ? $config['onebuttoninstaller']['storage_path'] : $g['media_path']; + +include("fbegin.inc"); ?> +
+ + +
+ + + + + /mnt/)."), $pconfig['storage_path'], true, 60);?> +
+
+ "/> + "/> +
+
+ +
+ diff --git a/README.md b/README.md index 596510c..53ad7c6 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ -Description -> will follow soon! +OneButtonInstaller +------------------ + +NAS4Free extension to display and install all known available Extensions/Add-Ons directly inside the NAS4Free WebGUI +just with the press of one button without the need to use the CLI. + +The extension +- allows the installation of all known Extensions/Add-Ons inside the NAS4Free WebGUI with a common interface +- allows a One Button Installation, just by selecting one or more entries and pressing 'Install' +- shows all known available/installed Extensions/Add-Ons on one page with a short description and links to the appropriate forum threads +- pre-checks and displays known unsupported platforms/architectures per extension +- features manual/automatic update of the Extensions list to get new extensions to install +- is based on the current installation procedures of the currently known extension/add-ons +- works on all plattforms +- does not need jail or pkg_add. +- add pages to NAS4Free WebGUI +- features easy installation, configuration and extension update & removal management + +INSTALLATION +------------ +1. Prior to the installation perform a backup of the NAS4Free configuration via SYSTEM | BACKUP/RESTORE | Download configuration. +2. Open the NAS4Free WebGUI menu entry ADVANCED | COMMAND, copy the following line, paste it to the command field and push "Execute", this will copy the installer to your system: +
fetch https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/OBI.php && \
+mkdir -p ext/OBI; echo 'OneButtonInstaller' > ext/OBI/menu.inc
+
+3. Open the NAS4Free WebGUI menu entry EXTENSIONS | OneButtonInstaller, choose a directory to install the extension to and hit 'Save' to finish the installation or hit 'Cancel' to abort and remove the installer from the system. +4. After successful completion you can access the extension from the WebGUI menu entry EXTENSIONS | OneButtonInstaller. + +DISCLAIMER +---------- +This Extensions is provided AS-IS, I'm NOT responsible for any data loss or damage caused by the use of it, use it solely at your own risk. diff --git a/onebuttoninstaller/ext/onebuttoninstaller-config.php b/onebuttoninstaller/ext/onebuttoninstaller-config.php index 6e1c505..25a9e49 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller-config.php +++ b/onebuttoninstaller/ext/onebuttoninstaller-config.php @@ -130,7 +130,7 @@ function enable_change(enable_change) {
- "/> + "/>
diff --git a/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo index 24f6562..799b1c7 100644 Binary files a/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/el/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/el/LC_MESSAGES/nas4free.mo index 717fb16..bb6c85b 100644 Binary files a/onebuttoninstaller/locale-obi/el/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/el/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/es/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/es/LC_MESSAGES/nas4free.mo index 20f1367..bbd8d48 100644 Binary files a/onebuttoninstaller/locale-obi/es/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/es/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/fr/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/fr/LC_MESSAGES/nas4free.mo index 3e8500a..cd916a1 100644 Binary files a/onebuttoninstaller/locale-obi/fr/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/fr/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/it/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/it/LC_MESSAGES/nas4free.mo index 923684a..fec2e44 100644 Binary files a/onebuttoninstaller/locale-obi/it/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/it/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/nl/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/nl/LC_MESSAGES/nas4free.mo new file mode 100644 index 0000000..8325ff1 Binary files /dev/null and b/onebuttoninstaller/locale-obi/nl/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/ro/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/ro/LC_MESSAGES/nas4free.mo new file mode 100644 index 0000000..8d85c23 Binary files /dev/null and b/onebuttoninstaller/locale-obi/ro/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/locale-obi/ru/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/ru/LC_MESSAGES/nas4free.mo index 709552a..6640510 100644 Binary files a/onebuttoninstaller/locale-obi/ru/LC_MESSAGES/nas4free.mo and b/onebuttoninstaller/locale-obi/ru/LC_MESSAGES/nas4free.mo differ diff --git a/onebuttoninstaller/onebuttoninstaller-install.php b/onebuttoninstaller/onebuttoninstaller-install.php index b1c31d9..144e59c 100644 --- a/onebuttoninstaller/onebuttoninstaller-install.php +++ b/onebuttoninstaller/onebuttoninstaller-install.php @@ -29,29 +29,15 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ -/* -Version Date Description -0.1-b6 2016.06.16 recognition of extensions without GUI / config.xml entries -0.1-b4 2016.04.07 2451 compatibility -0.1-b3 2016.02.06 N: add language support -0.1-b2 2016.02.02 N: check for supported architecture, plattform - N: auto update of extensions list -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 = "v0.1-b6"; // extension version +$v = "v0.1-b7"; // extension version $appname = "OneButtonInstaller"; require_once("config.inc"); $arch = $g['arch']; $platform = $g['platform']; -if (($arch != "i386" && $arch != "amd64") && ($arch != "x86" && $arch != "x64" && $arch != "rpi")) { echo "\f{$arch} is an unsupported architecture!\n"; exit(1); } -if ($platform != "embedded" && $platform != "full" && $platform != "livecd" && $platform != "liveusb") { echo "\funsupported platform!\n"; exit(1); } +//if (($arch != "i386" && $arch != "amd64") && ($arch != "x86" && $arch != "x64" && $arch != "rpi" && $arch != "rpi2")) { echo "\f{$arch} is an unsupported architecture!\n"; exit(1); } +//if ($platform != "embedded" && $platform != "full" && $platform != "livecd" && $platform != "liveusb") { echo "\funsupported platform!\n"; exit(1); } // install extension global $input_errors; @@ -108,8 +94,8 @@ if ( !isset($config['onebuttoninstaller']) || !is_array($config['onebuttoninstal $config['rc']['shutdown']['cmd'][$i] = $config['onebuttoninstaller']['rootfolder']."onebuttoninstaller_stop.php"; write_config(); require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php"); - echo "\n".$appname." Version ".$config['onebuttoninstaller']['version']." installed"; - echo "\n\nInstallation completed, use WebGUI | Extensions | ".$appname." to configure \nthe application (don't forget to refresh the WebGUI before use)!\n"; +// echo "\n".$appname." Version ".$config['onebuttoninstaller']['version']." installed"; +// echo "\n\nInstallation completed, use WebGUI | Extensions | ".$appname." to configure \nthe application (don't forget to refresh the WebGUI before use)!\n"; } else { // update release diff --git a/onebuttoninstaller/release_notes.txt b/onebuttoninstaller/release_notes.txt index 6c376ca..c742d7e 100644 --- a/onebuttoninstaller/release_notes.txt +++ b/onebuttoninstaller/release_notes.txt @@ -1,6 +1,7 @@ Version Date Description -0.1-b6 2016.06.16 recognition of extensions without GUI / config.xml entries -0.1-b4 2016.04.07 2451 compatibility +0.1-b7 2016.07.23 N: OBI extension installer +0.1-b6 2016.06.16 N: recognition of extensions without GUI / config.xml entries +0.1-b4 2016.04.07 C: 2451 compatibility 0.1-b3 2016.02.06 N: add language support 0.1-b2 2016.02.01 N: check for supported architecture, plattform N: auto update of extensions list diff --git a/onebuttoninstaller/version.txt b/onebuttoninstaller/version.txt index c1ed2ad..6a97bb5 100644 --- a/onebuttoninstaller/version.txt +++ b/onebuttoninstaller/version.txt @@ -1 +1 @@ -0.1-b6 +0.1-b7 diff --git a/onebuttoninstaller_install.php b/onebuttoninstaller_install.php deleted file mode 100644 index 9117070..0000000 --- a/onebuttoninstaller_install.php +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/local/bin/php-cgi -f -= 9.3 -$release = explode("-", exec("uname -r")); -if ($release[0] >= 9.3) $verify_hostname = "--no-verify-hostname"; -else $verify_hostname = ""; - -$install_dir = dirname(__FILE__)."/"; // 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 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"); -} -else { echo "\nInstallation file 'onebuttoninstaller-install.php' not found, installation aborted!\n"; } -?>