b7
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/*
|
||||
OBI.php
|
||||
|
||||
Copyright (c) 2015 - 2016 Andreas Schmidhuber
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
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");
|
||||
|
||||
$application = "OneButtonInstaller";
|
||||
$pgtitle = array(gettext("Extensions"), gettext($application), gettext("Configuration"));
|
||||
|
||||
if (!isset($config['onebuttoninstaller']) || !is_array($config['onebuttoninstaller'])) $config['onebuttoninstaller'] = array();
|
||||
|
||||
/* 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
|
||||
*/
|
||||
function change_perms($dir) {
|
||||
global $input_errors;
|
||||
|
||||
$path = rtrim($dir,'/'); // remove trailing slash
|
||||
if (strlen($path) > 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 <a href='disks_mount.php'>Disks | Mount Point | Management</a> or <a href='disks_zfs_dataset.php'>Disks | ZFS | Datasets</a>) 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"); ?>
|
||||
<form action="OBI.php" method="post" name="iform" id="iform">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td class="tabcont">
|
||||
<?php if (!empty($input_errors)) print_input_errors($input_errors);?>
|
||||
<?php if (!empty($savemsg)) print_info_box($savemsg);?>
|
||||
<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 root 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>
|
||||
<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");?>"/>
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
<?php include("formend.inc");?>
|
||||
</form>
|
||||
<?php include("fend.inc");?>
|
||||
@@ -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:
|
||||
<pre>fetch https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/OBI.php && \
|
||||
mkdir -p ext/OBI; echo '<a href="OBI.php">OneButtonInstaller</a>' > ext/OBI/menu.inc
|
||||
</pre>
|
||||
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.
|
||||
|
||||
@@ -130,7 +130,7 @@ function enable_change(enable_change) {
|
||||
<?php html_checkbox("auto_update", gettext("Update"), $pconfig['auto_update'], gettext("Update extensions list automatically."), "", false);?>
|
||||
</table>
|
||||
<div id="submit">
|
||||
<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save & Restart");?>"/>
|
||||
<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>"/>
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.1-b6
|
||||
0.1-b7
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/local/bin/php-cgi -f
|
||||
<?php
|
||||
require_once("config.inc");
|
||||
|
||||
// check FreeBSD release for fetch options >= 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"; }
|
||||
?>
|
||||
Reference in New Issue
Block a user