alpha release 4
This commit is contained in:
crestAT
2016-01-25 19:12:05 +01:00
parent 18f474b7d1
commit 94c5ff0aa7
15 changed files with 1084 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
#!/bin/sh
# filename: mcommander.sh
# author: Dan Merschi
# date: 2009-07-28 ; Add multiplatform support
# author: Graham Inggs <graham@nerve.org.za>
# date: 2012-04-11 ; Updated for NAS4Free 9.0.0.1
# date: 2013-02-09 ; Updated for ftp.freebsd.org restructuring and latest mc-light version
# date: 2013-05-05 ; Switch from mc-light to mc ; drop compat7x ; add libslang
# date: 2013-08-10 ; Update mc package name to mc-4.8.8.tbz
# date: 2013-08-23 ; Fetch files from packages-9.2-release ; add libssh2
# date: 2014-12-18 ; Update for v9.3; Clean up
# date: 2015-02-21 ; Update mc package to mc-4.8.11.tbz
# purpose: Install Midnight Commander on NAS4Free (embedded version).
# Note: Check the end of the page.
#
#----------------------- Set variables ------------------------------------------------------------------
DIR=`dirname $0`;
URL="ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-9.2-release/Latest"
MCLIGHTFILE="mc.tbz"
LIBSLANGFILE="libslang2.tbz"
LIBSSH2FILE="libssh2.tbz"
#----------------------- Set Errors ---------------------------------------------------------------------
_msg() { case $@ in
0) echo "The script will exit now."; exit 0 ;;
1) echo "Error! Can not download ${FILE}"; _msg 0 ;;
2) echo "Can't find ${FILE} on ${DIR}"; _msg 0 ;;
3) echo "Midnight Commander installed and ready!"; exit 0 ;;
4) echo "Always run this script using the full path: /path/to/$(basename $0)"; _msg 0 ;;
esac }
#----------------------- Check for full path ------------------------------------------------------------
[ `echo $0 | cut -c1` = "/" ] || _msg 4
cd ${DIR}
#----------------------- Download and decompress mc files if don't exist --------------------------------
FILE=${MCLIGHTFILE}
if [ ! -d ${DIR}/bin ]; then
if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi
if [ -r ${DIR}/${FILE} ]; then tar -xf ${DIR}/${FILE} || _msg 2; rm ${DIR}/+*; rm -R ${DIR}/man; fi
[ -d ${DIR}/bin ] || _msg 4
fi
#----------------------- Download and decompress libslang files if don't exist --------------------------
FILE=${LIBSLANGFILE}
if [ ! -d ${DIR}/lib ]; then
if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi
if [ -r ${DIR}/${FILE} ]; then tar -xf ${DIR}/${FILE} || _msg 2; rm ${DIR}/+*;
rm -R ${DIR}/libdata; rm -R ${DIR}/man; rm -R ${DIR}/include; rm ${DIR}/lib/*.a;
rm ${DIR}/bin/slsh; rm ${DIR}/etc/slsh.rc; fi
[ -d ${DIR}/lib ] || _msg 4
fi
#----------------------- Download and decompress libssh2 files if don't exist ---------------------------
FILE=${LIBSSH2FILE}
if [ ! -f ${DIR}/lib/libssh2.so ]; 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}/libdata; rm -R ${DIR}/man; rm -R ${DIR}/include; rm ${DIR}/lib/*.a; rm ${DIR}/lib/*.la; fi
if [ ! -d ${DIR}/lib ]; then _msg 4; fi
fi
#----------------------- Create symlinks ----------------------------------------------------------------
[ -e /usr/local/share/mc ] || ln -s ${DIR}/share/mc /usr/local/share
[ -e /usr/local/libexec/mc ] || ln -s ${DIR}/libexec/mc /usr/local/libexec
[ -e /usr/local/etc/mc ] || ln -s ${DIR}/etc/mc /usr/local/etc
for i in `ls ${DIR}/bin/`; do
[ -e /usr/local/bin/${i} ] || ln -s ${DIR}/bin/${i} /usr/local/bin
done
for i in `ls ${DIR}/share/locale`; do
if [ ! -e /usr/local/share/locale/${i} ]; then
ln -s ${DIR}/share/locale/${i} /usr/local/share/locale
else
[ -e /usr/local/share/locale/${i}/LC_MESSAGES/mc.mo ] || \
ln -s ${DIR}/share/locale/${i}/LC_MESSAGES/mc.mo /usr/local/share/locale/${i}/LC_MESSAGES
fi
done
for i in `ls ${DIR}/lib`; do
[ -e /usr/local/lib/${i} ] || ln -s ${DIR}/lib/${i} /usr/local/lib
done
# Symlinks for v10.1.0.2
cd /usr/local/lib
[ -e libssl.so.6 ] || ln -s /usr/lib/libssl.so.7 libssl.so.6
[ -e libcrypto.so.6 ] || ln -s /lib/libcrypto.so.7 libcrypto.so.6
[ -e libpcre.so.3 ] || ln -s /usr/local/lib/libpcre.so.1 libpcre.so.3
[ -e libintl.so.9 ] || ln -s /usr/local/lib/libintl.so.8 libintl.so.9
[ -e libiconv.so.3 ] || ln -s /usr/local/lib/libiconv.so.2 libiconv.so.3
cd -
# Aliases
mkdir -p /etc/profile.d
ln -s ${DIR}/libexec/mc/mc.sh /etc/profile.d
ln -s ${DIR}/libexec/mc/mc.csh /etc/profile.d
cat <<'EOFF' >> /etc/profile
# Append any additional sh scripts found in /etc/profile.d
for profile_script in /etc/profile.d/*.sh; do
[ -x ${profile_script} ] && . ${profile_script}
done
unset profile_script
EOFF
cat <<'EOFF' >> /etc/csh.login
# Append any additional csh scripts found in /etc/profile.d
[ -d /etc/profile.d ]
if ($status == 0) then
set nonomatch
foreach file ( /etc/profile.d/*.csh )
[ -x $file ]
if ($status == 0) then
source $file
endif
end
unset file nonomatch
endif
EOFF
# Done
_msg 3
#----------------------- End of Script ------------------------------------------------------------------
# 1. Keep this script in his own directory.
# 2. chmod the script u+x,
# 3. Always run this script using the full path: /mnt/share/directory/mcommander
# 4. You can add this script to WebGUI: Advanced: Commands as Post command (see 3).
# 5. To run Midnight Commander from shell type 'mc'.

View File

@@ -0,0 +1 @@
<a href="onebuttoninstaller.php">OneButtonInstaller</a>

View File

@@ -0,0 +1,2 @@
// http://spin.js.org/#v2.3.2
!function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;if(b=b.charAt(0).toUpperCase()+b.slice(1),void 0!==e[b])return b;for(d=0;d<l.length;d++)if(c=l[d]+b,void 0!==e[c])return c}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k,l=["webkit","Moz","ms","O"],m={},n={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:!1,hwaccel:!1,position:"absolute"};if(h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c=this,d=c.opts,f=c.el=a(null,{className:d.className});if(e(f,{position:d.position,width:0,zIndex:d.zIndex,left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.scale*(f.length+f.width)+"px",height:f.scale*f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.scale*f.radius+"px,0)",borderRadius:(f.corners*f.scale*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.scale*f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}}),"undefined"!=typeof document){k=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}();var o=e(a("group"),{behavior:"url(#default#VML)"});!d(o,"transform")&&o.adj?i():j=d(o,"animation")}return h});

View File

@@ -0,0 +1,292 @@
<?php
/*
onebuttoninstaller-config.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");
// Dummy standard message gettext calls for xgettext retrieval!!!
$dummy = gettext("The changes have been applied successfully.");
$dummy = gettext("The configuration has been changed.<br />You must apply the changes in order for them to take effect.");
$dummy = gettext("The following input errors were detected");
$pgtitle = array(gettext("Extensions"), gettext("OneButtonInstaller")." ".$config['onebuttoninstaller']['version'], 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("OneButtonInstaller 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."), $path, "/{$path_check[1]}/{$path_check[2]}");
}
}
}
}
function cronjob_process_updatenotification($mode, $data) {
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
write_config();
}
}
break;
}
return $retval;
}
if (isset($_POST['save']) && $_POST['save']) {
unset($input_errors);
if (empty($input_errors)) {
$config['onebuttoninstaller']['enable'] = isset($_POST['enable']) ? true : false;
$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($_POST['storage_path']);
if (isset($_POST['enable_schedule']) && ($_POST['startup'] == $_POST['closedown'])) { $input_errors[] = gettext("Startup and closedown hour must be different!"); }
else {
if (isset($_POST['enable_schedule'])) {
$config['onebuttoninstaller']['enable_schedule'] = isset($_POST['enable_schedule']) ? true : false;
$config['onebuttoninstaller']['schedule_startup'] = $_POST['startup'];
$config['onebuttoninstaller']['schedule_closedown'] = $_POST['closedown'];
$cronjob = array();
$a_cronjob = &$config['cron']['job'];
$uuid = isset($config['onebuttoninstaller']['schedule_uuid_startup']) ? $config['onebuttoninstaller']['schedule_uuid_startup'] : false;
if (isset($uuid) && (FALSE !== ($cnid = array_search_ex($uuid, $a_cronjob, "uuid")))) {
$cronjob['enable'] = true;
$cronjob['uuid'] = $a_cronjob[$cnid]['uuid'];
$cronjob['desc'] = "OneButtonInstaller startup (@ {$config['onebuttoninstaller']['schedule_startup']}:00)";
$cronjob['minute'] = $a_cronjob[$cnid]['minute'];
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_startup'];
$cronjob['day'] = $a_cronjob[$cnid]['day'];
$cronjob['month'] = $a_cronjob[$cnid]['month'];
$cronjob['weekday'] = $a_cronjob[$cnid]['weekday'];
$cronjob['all_mins'] = $a_cronjob[$cnid]['all_mins'];
$cronjob['all_hours'] = $a_cronjob[$cnid]['all_hours'];
$cronjob['all_days'] = $a_cronjob[$cnid]['all_days'];
$cronjob['all_months'] = $a_cronjob[$cnid]['all_months'];
$cronjob['all_weekdays'] = $a_cronjob[$cnid]['all_weekdays'];
$cronjob['who'] = 'root';
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_start.php && logger onebuttoninstaller: scheduled startup";
} else {
$cronjob['enable'] = true;
$cronjob['uuid'] = uuid();
$cronjob['desc'] = "OneButtonInstaller startup (@ {$config['onebuttoninstaller']['schedule_startup']}:00)";
$cronjob['minute'] = 0;
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_startup'];
$cronjob['day'] = true;
$cronjob['month'] = true;
$cronjob['weekday'] = true;
$cronjob['all_mins'] = 0;
$cronjob['all_hours'] = 0;
$cronjob['all_days'] = 1;
$cronjob['all_months'] = 1;
$cronjob['all_weekdays'] = 1;
$cronjob['who'] = 'root';
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_start.php && logger onebuttoninstaller: scheduled startup";
$config['onebuttoninstaller']['schedule_uuid_startup'] = $cronjob['uuid'];
}
if (isset($uuid) && (FALSE !== $cnid)) {
$a_cronjob[$cnid] = $cronjob;
$mode = UPDATENOTIFY_MODE_MODIFIED;
} else {
$a_cronjob[] = $cronjob;
$mode = UPDATENOTIFY_MODE_NEW;
}
updatenotify_set("cronjob", $mode, $cronjob['uuid']);
// write_config();
unset ($cronjob);
$cronjob = array();
$a_cronjob = &$config['cron']['job'];
$uuid = isset($config['onebuttoninstaller']['schedule_uuid_closedown']) ? $config['onebuttoninstaller']['schedule_uuid_closedown'] : false;
if (isset($uuid) && (FALSE !== ($cnid = array_search_ex($uuid, $a_cronjob, "uuid")))) {
$cronjob['enable'] = true;
$cronjob['uuid'] = $a_cronjob[$cnid]['uuid'];
$cronjob['desc'] = "OneButtonInstaller closedown (@ {$config['onebuttoninstaller']['schedule_closedown']}:00)";
$cronjob['minute'] = $a_cronjob[$cnid]['minute'];
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_closedown'];
$cronjob['day'] = $a_cronjob[$cnid]['day'];
$cronjob['month'] = $a_cronjob[$cnid]['month'];
$cronjob['weekday'] = $a_cronjob[$cnid]['weekday'];
$cronjob['all_mins'] = $a_cronjob[$cnid]['all_mins'];
$cronjob['all_hours'] = $a_cronjob[$cnid]['all_hours'];
$cronjob['all_days'] = $a_cronjob[$cnid]['all_days'];
$cronjob['all_months'] = $a_cronjob[$cnid]['all_months'];
$cronjob['all_weekdays'] = $a_cronjob[$cnid]['all_weekdays'];
$cronjob['who'] = 'root';
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_stop.php && logger onebuttoninstaller: scheduled closedown";
} else {
$cronjob['enable'] = true;
$cronjob['uuid'] = uuid();
$cronjob['desc'] = "OneButtonInstaller closedown (@ {$config['onebuttoninstaller']['schedule_closedown']}:00)";
$cronjob['minute'] = 0;
$cronjob['hour'] = $config['onebuttoninstaller']['schedule_closedown'];
$cronjob['day'] = true;
$cronjob['month'] = true;
$cronjob['weekday'] = true;
$cronjob['all_mins'] = 0;
$cronjob['all_hours'] = 0;
$cronjob['all_days'] = 1;
$cronjob['all_months'] = 1;
$cronjob['all_weekdays'] = 1;
$cronjob['who'] = 'root';
$cronjob['command'] = "{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller_stop.php && logger onebuttoninstaller: scheduled closedown";
$config['onebuttoninstaller']['schedule_uuid_closedown'] = $cronjob['uuid'];
}
if (isset($uuid) && (FALSE !== $cnid)) {
$a_cronjob[$cnid] = $cronjob;
$mode = UPDATENOTIFY_MODE_MODIFIED;
} else {
$a_cronjob[] = $cronjob;
$mode = UPDATENOTIFY_MODE_NEW;
}
updatenotify_set("cronjob", $mode, $cronjob['uuid']);
// write_config();
} // end of enable_schedule
else {
$config['onebuttoninstaller']['enable_schedule'] = isset($_POST['enable_schedule']) ? true : false;
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_startup']);
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
}
}
// write_config();
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_closedown']);
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
}
}
// write_config();
} // end of disable_schedule -> remove cronjobs
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
$retval |= updatenotify_process("cronjob", "cronjob_process_updatenotification");
config_lock();
$retval |= rc_update_service("cron");
config_unlock();
}
// $savemsg .= get_std_save_message($retval).'<br />';
if ($retval == 0) {
updatenotify_delete("cronjob");
}
} // end of schedule change
$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'];
include("fbegin.inc");?>
<script type="text/javascript">
<!--
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;
}
//-->
</script>
<form action="onebuttoninstaller-config.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<ul id="tabnav">
<?php if (isset($config['onebuttoninstaller']['enable'])) { ?>
<li class="tabinact"><a href="onebuttoninstaller.php"><span><?=gettext("Install");?></span></a></li>
<li class="tabact"><a href="onebuttoninstaller-config.php"><span><?=gettext("Configuration");?></span></a></li>
<li class="tabinact"><a href="onebuttoninstaller-update_extension.php"><span><?=gettext("Maintenance");?></span></a></li>
<?php } else { ?>
<li class="tabact"><a href="onebuttoninstaller-config.php"><span><?=gettext("Configuration");?></span></a></li>
<li class="tabinact"><a href="onebuttoninstaller-update_extension.php"><span><?=gettext("Maintenance");?></span></a></li>
<?php } ?>
</ul>
</td></tr>
<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_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 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 & Restart");?>"/>
</div>
</td></tr>
</table>
<?php include("formend.inc");?>
</form>
<script type="text/javascript">
<!--
enable_change(false);
//-->
</script>
<?php include("fend.inc");?>

View File

@@ -0,0 +1,199 @@
<?php
/*
onebuttoninstaller-update_extension.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");
$pgtitle = array(gettext("Extensions"), gettext("OneButtonInstaller")." ".$config['onebuttoninstaller']['version'], gettext("Maintenance"));
if (is_file("{$config['onebuttoninstaller']['rootfolder']}log/oneload")) { require_once("{$config['onebuttoninstaller']['rootfolder']}log/oneload"); }
$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")); }
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!"); }
function cronjob_process_updatenotification($mode, $data) {
global $config;
$retval = 0;
switch ($mode) {
case UPDATENOTIFY_MODE_NEW:
case UPDATENOTIFY_MODE_MODIFIED:
break;
case UPDATENOTIFY_MODE_DIRTY:
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
write_config();
}
}
break;
}
return $retval;
}
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']);) {
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']); ) {
if (preg_match('/onebuttoninstaller/', $config['rc']['shutdown']['cmd'][$i])) { unset($config['rc']['shutdown']['cmd'][$i]); } else {}
++$i;
}
}
// remove cronjobs
if (isset($config['onebuttoninstaller']['enable_schedule'])) {
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_startup']);
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
}
}
write_config();
updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $config['onebuttoninstaller']['schedule_uuid_closedown']);
if (is_array($config['cron']['job'])) {
$index = array_search_ex($data, $config['cron']['job'], "uuid");
if (false !== $index) {
unset($config['cron']['job'][$index]);
}
}
write_config();
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
$retval |= updatenotify_process("cronjob", "cronjob_process_updatenotification");
config_lock();
$retval |= rc_update_service("cron");
config_unlock();
}
$savemsg = get_std_save_message($retval);
if ($retval == 0) {
updatenotify_delete("cronjob");
}
}
// remove extension pages
mwexec ("rm -rf /usr/local/www/ext/onebuttoninstaller");
mwexec ("rm -rf /usr/local/www/onebuttoninstaller*");
// remove application section from config.xml
if ( is_array($config['onebuttoninstaller'] ) ) { unset( $config['onebuttoninstaller'] ); write_config();}
header("Location:index.php");
}
if (isset($_POST['ext_update']) && $_POST['ext_update']) {
// download installer & install
$return_val = mwexec("fetch -vo {$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true);
if ($return_val == 0) {
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-install.php");
header("Refresh:8");;
}
else { $input_errors[] = sprintf(gettext("Download of installation file %s failed, installation aborted!"), "onebuttoninstaller-install.php"); }
}
include("fbegin.inc");?>
<script type="text/javascript">
function spinner() {
var opts = {
lines: 10, // The number of lines to draw
length: 7, // The length of each line
width: 4, // The line thickness
radius: 10, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
};
var target = document.getElementById('foo');
var spinner = new Spinner(opts).spin(target);
}
</script>
<div id="foo">
<script src="ext/onebuttoninstaller/spin.min.js"></script>
<form action="onebuttoninstaller-update_extension.php" method="post" name="iform" id="iform" onsubmit="spinner()">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<ul id="tabnav">
<?php if (isset($config['onebuttoninstaller']['enable'])) { ?>
<li class="tabinact"><a href="onebuttoninstaller.php"><span><?=gettext("Install");?></span></a></li>
<li class="tabinact"><a href="onebuttoninstaller-config.php"><span><?=gettext("Configuration");?></span></a></li>
<li class="tabact"><a href="onebuttoninstaller-update_extension.php"><span><?=gettext("Maintenance");?></span></a></li>
<?php } else { ?>
<li class="tabinact"><a href="onebuttoninstaller-config.php"><span><?=gettext("Configuration");?></span></a></li>
<li class="tabact"><a href="onebuttoninstaller-update_extension.php"><span><?=gettext("Maintenance");?></span></a></li>
<?php } ?>
</ul>
</td></tr>
<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(gettext("Extension Update"));?>
<?php html_text("ext_version_current", gettext("Installed version"), $config['onebuttoninstaller']['version']);?>
<?php html_text("ext_version_server", gettext("Latest version"), $server_version);?>
<?php html_separator();?>
</table>
<div id="update_remarks">
<?php html_remark("note_remove", gettext("Note"), gettext("Removing OneButtonInstaller integration from NAS4Free will leave the installation folder untouched - remove the files using Windows Explorer, FTP or some other tool of your choice. <br /><b>Please note: this page will no longer be available.</b> You'll have to re-run OneButtonInstaller extension installation to get it back on your NAS4Free."));?>
<br />
<input id="ext_update" name="ext_update" type="submit" class="formbtn" value="<?=gettext("Update Extension");?>" onclick="return confirm('<?=gettext("The selected operation will be completed. Please do not click any other buttons!");?>')" />
<input id="ext_remove" name="ext_remove" type="submit" class="formbtn" value="<?=gettext("Remove Extension");?>" onclick="return confirm('<?=gettext("Do you really want to remove the extension from the system?");?>')" />
</div>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<?php html_separator();?>
<?php html_separator();?>
<?php html_titleline(gettext("Extension")." ".gettext("Release Notes"));?>
<tr>
<td class="listt">
<div>
<textarea style="width: 98%;" id="content" name="content" class="listcontent" cols="1" rows="25" readonly="readonly"><?php unset($lines); exec("/bin/cat {$config['onebuttoninstaller']['rootfolder']}release_notes.txt", $lines); foreach ($lines as $line) { echo $line."\n"; }?></textarea>
</div>
</td>
</tr>
</table>
<?php include("formend.inc");?>
</td></tr>
</table>
</form>
<?php include("fend.inc");?>
</div> <!-- foo -->

View File

@@ -0,0 +1,223 @@
<?php
/*
onebuttoninstaller.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");
if (!isset($config['onebuttoninstaller']['enable'])) header("Location:onebuttoninstaller-config.php");
$pgtitle = array(gettext("Extensions"), gettext("OneButtonInstaller")." ".$config['onebuttoninstaller']['version']);
$log = 0;
$loginfo = array(
array(
"visible" => TRUE,
"desc" => gettext("Extensions"),
"logfile" => "{$config['onebuttoninstaller']['rootfolder']}extensions.txt",
"filename" => "extensions.txt",
"type" => "plain",
"pattern" => "/^(.*)###(.*)###(.*)###(.*)###(.*)###(.*)$/",
"columns" => array(
array("title" => gettext("Extensions"), "class" => "listlr", "param" => "align=\"left\" valign=\"middle\" nowrap", "pmid" => 0),
array("title" => gettext("Version"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 1),
array("title" => gettext("Description"), "class" => "listr", "param" => "align=\"left\" valign=\"middle\"", "pmid" => 5),
array("title" => gettext("Install"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 4)
))
);
function log_get_contents($logfile) {
$content = array();
if (is_file($logfile)) exec("cat {$logfile}", $extensions);
else return;
$content = $extensions;
return $content;
}
function log_display($loginfo) {
global $config;
global $savemsg;
if (!is_array($loginfo)) return;
// Create table header
echo "<tr>";
foreach ($loginfo['columns'] as $columnk => $columnv) {
echo "<td {$columnv['param']} class='" . (($columnk == 0) ? "listhdrlr" : "listhdrr") . "'>".htmlspecialchars($columnv['title'])."</td>\n";
}
echo "</tr>";
// Get file content
$content = log_get_contents($loginfo['logfile']);
if (empty($content)) return;
sort($content);
$j = 0;
/*
* EXTENSIONS.TXT format description: PARAMETER DELIMITER -> ###
* PMID COMMENT
* 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
* description: 5 plain text which can include HTML tags
*/
/* DEBUGGER
print_r($result[3]);
echo('<br />');
print_r($result[4]);
echo('<br />');
*/
// Create table data
foreach ($content as $contentv) { // handle each line => one extension
unset($result);
$result = explode("###", $contentv); // retrieve extension content (pmid based)
if ((FALSE === $result) || (0 == $result)) continue;
echo "<tr valign=\"top\">\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)
if ((isset($config[$result[2]])) || ((strpos($result[2], "/") == 0) && (is_dir("{$config['onebuttoninstaller']['storage_path']}{$result[2]}")))){
echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'> <img src='status_enabled.png' border='0' alt='' title='".gettext('Enabled')."' /> </td>\n";
}
else { // data for installation
echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'>
<input type='checkbox' name='name[".$j."][extension]' value='".$result[2]."' />
<input type='hidden' name='name[".$j."][command1]' value='".$result[3]."' />
<input type='hidden' name='name[".$j."][command2]' value='".$result[4]."' />
</td>\n";
}
}
else echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'>" . $result[$loginfo['columns'][$i]['pmid']] . "</td>\n";
}
echo "</tr>\n";
$j++;
}
}
//ob_start();
//$ausgabe = ob_get_contents();
//ob_end_clean();
//foreach ($ausgabe as $msg) $savemsg .= $msg."<br />";
if (isset($_POST) && $_POST) {
foreach($_POST[name] as $line) {
if (isset($line['extension'])) {
$savemsg .= "<b>{$line['extension']}</b>"."<br />";
$savemsg .= print_r($line, true)."<br />";
unset($result);
exec("cd {$config["onebuttoninstaller"]["storage_path"]} && {$line['command1']}", $result, $return_val);
if ($return_val == 0) {
$savemsg .= "<b>command1 successful</b>"."<br />";
foreach ($result as $msg) $savemsg .= $msg."<br />";
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 .= "<br />"."<b>command2 successful</b>"."<br />";
// foreach ($result as $msg) $savemsg .= $msg."<br />";
}
else {
$errormsg .= gettext("Error")."<br />";
// foreach ($result as $msg) $errormsg .= $msg."<br />";
$savemsg .= "<b>command2 NOT successful</b>"."<br />";
}
}
// else $errormsg .= "Error: file {$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']} not found!"."<br />";
}
else {
$errormsg .= gettext("Error on command1")."<br />";
foreach ($result as $msg) $errormsg .= $msg."<br />";
$savemsg .= "<b>command1 NOT successful</b>"."<br />";
}
}
}
}
if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $savemsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt");
include("fbegin.inc");?>
<script type="text/javascript">
function spinner() {
var opts = {
lines: 10, // The number of lines to draw
length: 7, // The length of each line
width: 4, // The line thickness
radius: 10, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
};
var target = document.getElementById('foo');
var spinner = new Spinner(opts).spin(target);
}
</script>
<div id="foo">
<script src="ext/onebuttoninstaller/spin.min.js"></script>
<form action="onebuttoninstaller.php" method="post" name="iform" id="iform" onsubmit="spinner()">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<ul id="tabnav">
<li class="tabact"><a href="onebuttoninstaller.php"><span><?=gettext("Install");?></span></a></li>
<li class="tabinact"><a href="onebuttoninstaller-config.php"><span><?=gettext("Configuration");?></span></a></li>
<li class="tabinact"><a href="onebuttoninstaller-update_extension.php"><span><?=gettext("Maintenance");?></span></a></li>
</ul>
</td></tr>
<tr><td class="tabcont">
<?php if (!empty($errormsg)) print_error_box($errormsg);?>
<?php if (!empty($savemsg)) print_info_box($savemsg);?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php
log_display($loginfo[$log]);
?>
</table>
<div id="submit">
<input name="install" type="submit" class="formbtn" title="<?=gettext("Install extensions");?>" value="<?=gettext("Install");?>" onclick="return confirm('<?=gettext("Ready to install the selected extensions?");?>')" />
<input name="update" type="submit" class="formbtn" title="<?=gettext("Update extensions list");?>" value="<?=gettext("Update");?>" />
</div>
<?php include("formend.inc");?>
</td></tr>
</table>
</form>
<?php include("fend.inc");?>
</div> <!-- foo -->

View File

@@ -0,0 +1,13 @@
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.<br><br>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.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=6405' target='_blank'>NAS4Free Forum</a>
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.<br><br>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.<br><br>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.<br><br>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.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=8299' target='_blank'>NAS4Free Forum</a>
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.<br><br>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.<br><br><b>Note:</b> 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 <b>1.4.111:</b><br><b>64 bit: </b>http://syncapp.bittorrent.com/1.4.111/btsync_freebsd_x64-1.4.111.tar.gz<br><b>32 bit: </b>http://syncapp.bittorrent.com/1.4.111/btsync_freebsd_i386-1.4.111.tar.gz<br>and hit Save URL, Fetch and Install.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=5704' target='_blank'>NAS4Free Forum</a>
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.<br><br>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.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=7821' target='_blank'>NAS4Free Forum</a>
ezPlex Lite###2.01###ezplex###mkdir -p plex && cd plex && fetch https://dl.dropboxusercontent.com/u/98883057/Unix/NAS4Free/Addons/ezPlex/Release/v2%20Lite/ezplex-201-lite.tgz && tar xf ezplex*.tgz && echo "fetch OK"###plex/plex/ezplex.php###Plex Offline Installer for NAS4Free 9.3/10.2 x64.<br><br>The extension works on NAS4Free Embedded and Full platforms 9.3/10.x 64-Bit, don't need chroot/jail or fstab configurations, automatically creates/configure Unionfs on NAS4Free Embedded, Plex package can be natively upgraded through the ezPlex installer or through pkg upgrade on either platforms*, will add the corresponding user configurable Plex entries on the WebGUI automatically, Plex IP address will be locally visible by clients/devices, no changes will be made to the NAS4Free default shell profiles.<br><br><b>Note: </b>After install simply reboot and enjoy ezPlex.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=9755' target='_blank'>NAS4Free Forum</a>
Finch Lite###1.51###finch###mkdir -p finch && cd finch && fetch https://dl.dropboxusercontent.com/u/98883057/Unix/NAS4Free/Addons/Finch-Light/Release/Finch-Light%20for%20N4F%2010.2%20x64/finch-light-151-n4f10.2x64.tgz && echo "fetch OK" && tar -xvf finch-light*.tgz && echo "tar OK"###finch/finch/finch-light.php###Finch-Light Offline Installer for NAS4Free 10.2 based systems.<br><br>With this version of Finch(FreeBSD in a chroot) you can quickly install packages directly in to the chroot right after installation with pkg install pkgname, or just issue a portsnap fetch extract if you want to compile them, credits and thanks goes to Dreamcat4 the developer of Finch. After downloading and unzip the main files to the desired directory, run the finch-light.php and the script will gather the current working directory and bring up the install options, the Finch PostInit/Shutdown commands will be added to the WebGUI automatically, also remember to logout and login back to SSH/Console for the new shell to take effect.<br><br><b>Note:</b> default shell for root will be changed from tcsh to bash and is normal Finch behavior.<br><br>To auto configure Fstab go to Advanced|Execute command and provide the desired directory in the format shown below and execute it, also you can type dofstab -h for cli usage instead.<br><b>Format:</b> cd /path/to/media && dofstab -c<br><br>For manually edit Finch-Light fstab use Advanced|File Editor or CLI.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=9746' target='_blank'>NAS4Free Forum</a>
TheBrig###0.92###thebrig###mkdir -p thebrig && cd thebrig && fetch https://raw.githubusercontent.com/fsbruva/thebrig/alcatraz/thebrig_install.sh && chmod a+x thebrig_install.sh && sh thebrig_install.sh###-###Jail manager extension for NAS4Free.<br><br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=79&t=3894' target='_blank'>NAS4Free Forum</a>
DNSMasq DHCP Server###0.2###dnsmasq###mkdir -p dnsmasq && cd dnsmasq && fetch https://raw.github.com/alexey1234/nas4free-dnsmasq/master/dnsmasq_install.sh && chmod a+x dnsmasq_install.sh && sh dnsmasq_install.sh###-###DNSMasq DHCP Server extension for NAS4Free.<br><br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=71&t=3002' target='_blank'>NAS4Free Forum</a>
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.<br><br>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 <b>mc</b> in the CLI.<br>For more information -> <a href='http://forums.nas4free.org/viewtopic.php?f=70&t=187' target='_blank'>NAS4Free Forum</a>
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###<font size="5" color="blue">This is a testbed for NAS4Free extensions!!!</font><br><b>Note: </b><font size="3" color="red">Don't use this extension!!!</font>
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

View File

@@ -0,0 +1,126 @@
<?php
/*
onebuttoninstaller-install.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.
*/
/*
Version Date Description
0.1-a4 2016.01.25 initial release
0.1-a1 2016.01.16 initial release
*/
$v = "0.1-a4"; // 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); }
// install extension
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
$release = explode("-", exec("uname -r"));
if ($release[0] >= 9.3) $verify_hostname = "--no-verify-hostname";
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);
if ($return_val == 0) {
$return_val = 0;//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("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"; }
$savemsg = sprintf(gettext("Update to version %s completed!"), $file_version);
}
else {
$input_errors[] = sprintf(gettext("Archive file %s not found, installation aborted!"), "master.zip corrupt /");
return;
}
}
else {
$input_errors[] = sprintf(gettext("Archive file %s not found, installation aborted!"), "master.zip");
return;
}
// install / update application on NAS4Free
if ( !isset($config['onebuttoninstaller']) || !is_array($config['onebuttoninstaller'])) {
// new installation
$config['onebuttoninstaller'] = array();
$config['onebuttoninstaller']['appname'] = $appname;
$config['onebuttoninstaller']['version'] = exec("cat {$install_dir}version.txt");
$config['onebuttoninstaller']['rootfolder'] = $install_dir;
$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('/onebuttoninstaller/', $config['rc']['postinit']['cmd'][$i])) break; ++$i; }
}
$config['rc']['postinit']['cmd'][$i] = $config['onebuttoninstaller']['rootfolder']."onebuttoninstaller_start.php";
$i =0;
if ( is_array($config['rc']['shutdown'] ) && is_array( $config['rc']['shutdown']['cmd'] ) ) {
for ($i; $i < count($config['rc']['shutdown']['cmd']); ) {
if (preg_match('/onebuttoninstaller/', $config['rc']['shutdown']['cmd'][$i])) break; ++$i; }
}
$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";
}
else {
// update release
$config['onebuttoninstaller']['version'] = exec("cat {$install_dir}version.txt");
$config['onebuttoninstaller']['rootfolder'] = $install_dir;
$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('/onebuttoninstaller/', $config['rc']['postinit']['cmd'][$i])) break; ++$i; }
}
$config['rc']['postinit']['cmd'][$i] = $config['onebuttoninstaller']['rootfolder']."onebuttoninstaller_start.php";
$i =0;
if ( is_array($config['rc']['shutdown'] ) && is_array( $config['rc']['shutdown']['cmd'] ) ) {
for ($i; $i < count($config['rc']['shutdown']['cmd']); ) {
if (preg_match('/onebuttoninstaller/', $config['rc']['shutdown']['cmd'][$i])) break; ++$i; }
}
$config['rc']['shutdown']['cmd'][$i] = $config['onebuttoninstaller']['rootfolder']."onebuttoninstaller_stop.php";
write_config();
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php");
}
?>

View File

@@ -0,0 +1,36 @@
<?php
/*
onebuttoninstaller-start.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.
*/
$extension_dir = "/usr/local/www";
$return_val = mwexec("cp -R {$config['onebuttoninstaller']['rootfolder']}ext/* {$extension_dir}/", true);
if ($return_val == 0) exec("logger onebuttoninstaller: started");
else exec("logger onebuttoninstaller: error during startup, not started");
?>

View File

@@ -0,0 +1,36 @@
<?php
/*
onebuttoninstaller-stop.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.
*/
$extension_dir = "/usr/local/www";
mwexec("rm -Rf {$extension_dir}/onebuttoninstaller*", true);
mwexec("rm -Rf {$extension_dir}/ext/onebuttoninstaller", true);
exec("logger onebuttoninstaller: stopped");
?>

View File

@@ -0,0 +1,5 @@
#!/usr/local/bin/php-cgi -f
<?php
require_once("config.inc");
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-start.php");
?>

View File

@@ -0,0 +1,5 @@
#!/usr/local/bin/php-cgi -f
<?php
require_once("config.inc");
require_once("{$config['onebuttoninstaller']['rootfolder']}onebuttoninstaller-stop.php");
?>

View File

@@ -0,0 +1,6 @@
Version Date Description
0.1-a1 2016.01.19 initial release
N: ... new feature
C: ... changes
F: ... bug fix

View File

@@ -0,0 +1 @@
0.1-a4

View File

@@ -0,0 +1,16 @@
#!/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 = "";
$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);
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"; }
?>