-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
679 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
OneButtonInstaller | ||
------------------ | ||
|
||
Description in the NAS4Free forum -> <a href="http://forums.nas4free.org/viewtopic.php?f=71&t=11189">OneButtonInstaller</a> | ||
|
||
Please visit the XigmaNAS forum for full description and installation guide -> <a href="https://www.xigmanas.com/forums/viewtopic.php?f=71&t=11189">OneButtonInstaller</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/* | ||
universal postinit file for CLI extensions | ||
|
||
Copyright (c) 2015 - 2018 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. | ||
*/ | ||
|
||
require_once("config.inc"); | ||
|
||
$appName = "NCurses Disk Usage"; | ||
$command = "ncdu.sh"; | ||
$cmd = dirname(__FILE__)."/".$command; | ||
|
||
// remove start/stop commands | ||
// remove existing old rc format entries | ||
if (is_array($config['rc']) && is_array($config['rc']['postinit']) && is_array( $config['rc']['postinit']['cmd'])) { | ||
$rc_param_count = count($config['rc']['postinit']['cmd']); | ||
for ($i = 0; $i < $rc_param_count; $i++) { | ||
if (preg_match("/{$command}/", $config['rc']['postinit']['cmd'][$i])) unset($config['rc']['postinit']['cmd'][$i]); | ||
} | ||
} | ||
// remove existing entries for new rc format | ||
if (is_array($config['rc']) && is_array($config['rc']['param']['0'])) { | ||
$rc_param_count = count($config['rc']['param']); | ||
for ($i = 0; $i < $rc_param_count; $i++) { | ||
if (preg_match("/{$command}/", $config['rc']['param'][$i]['value'])) unset($config['rc']['param'][$i]); | ||
} | ||
} | ||
|
||
// check FreeBSD release | ||
$release = explode("-", exec("uname -r")); | ||
|
||
if ($release[0] >= 11.0) { // new rc format | ||
// postinit command | ||
$rc_param = []; | ||
$rc_param['uuid'] = uuid(); | ||
$rc_param['name'] = "{$appName} Extension"; | ||
$rc_param['value'] = "{$cmd}"; | ||
$rc_param['comment'] = "Start {$appName}"; | ||
$rc_param['typeid'] = '2'; | ||
$rc_param['enable'] = true; | ||
$config['rc']['param'][] = $rc_param; | ||
} | ||
else { | ||
$config['rc']['postinit']['cmd'][] = "{$cmd}"; | ||
} | ||
write_config(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
# filename: ncdu.sh | ||
# author: Graham Inggs | ||
# date: 2018-05-24 ; Initial release for NAS4Free 11.1.0.4 | ||
# purpose: Install NCurses Disk Usage (ncdu) on NAS4Free (embedded version). | ||
# Note: Check the end of the page. | ||
# | ||
#----------------------- Set variables ------------------------------------------------------------------ | ||
DIR=`dirname $0`; | ||
PLATFORM=`uname -m` | ||
RELEASE=`uname -r | cut -d- -f1` | ||
REL_MAJOR=`echo $RELEASE | cut -d. -f1` | ||
REL_MINOR=`echo $RELEASE | cut -d. -f2` | ||
#URL="http://distcache.freebsd.org/FreeBSD:${REL_MAJOR}:${PLATFORM}/release_${REL_MINOR}/All" | ||
URL="http://distcache.freebsd.org/FreeBSD:${REL_MAJOR}:${PLATFORM}/release_1/All" | ||
NCDUFILE="ncdu-1.12.txz" | ||
#----------------------- Set Errors --------------------------------------------------------------------- | ||
_msg() { case $@ in | ||
0) echo "The script will exit now."; exit 0 ;; | ||
1) echo "No route to server, or file do not exist on server"; _msg 0 ;; | ||
2) echo "Can't find ${FILE} on ${DIR}"; _msg 0 ;; | ||
3) echo "NCurses Disk Usage installed and ready! (ONLY USE DURING A SSH SESSION)"; exit 0 ;; | ||
4) echo "Always run this script using the full path: /mnt/.../directory/ncdu.sh"; _msg 0 ;; | ||
esac ; exit 0; } | ||
#----------------------- Check for full path ------------------------------------------------------------ | ||
if [ ! `echo $0 |cut -c1-5` = "/mnt/" ]; then _msg 4; fi | ||
cd $DIR; | ||
#----------------------- Download and decompress ncdu files if needed ----------------------------------- | ||
FILE=${NCDUFILE} | ||
if [ ! -d ${DIR}/usr/local/bin ]; then | ||
if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi | ||
if [ -f ${DIR}/${FILE} ]; then tar xzf ${DIR}/${FILE} || _msg 2; | ||
rm ${DIR}/+*; rm -R ${DIR}/usr/local/man; rm -R ${DIR}/usr/local/share; fi | ||
if [ ! -d ${DIR}/usr/local/bin ] ; then _msg 4; fi | ||
fi | ||
#----------------------- Create symlinks ---------------------------------------------------------------- | ||
for i in `ls $DIR/usr/local/bin/` | ||
do if [ ! -e /usr/local/bin/${i} ]; then ln -s ${DIR}/usr/local/bin/$i /usr/local/bin; fi; done | ||
_msg 3 ; exit 0; | ||
#----------------------- End of Script ------------------------------------------------------------------ | ||
# 1. Keep this script in its own directory. | ||
# 2. chmod the script u+x, | ||
# 3. Always run this script using the full path: /mnt/.../directory/ncdu.sh | ||
# 4. You can add this script to WebGUI: Advanced: Command Scripts as a PostInit command (see 3). | ||
# 5. To run Ncurses Disk Usage from shell type 'ncdu'. |
Oops, something went wrong.