From 2383b44961f4975a3fc0a70d96164bbed9cc9d7b Mon Sep 17 00:00:00 2001 From: Derek Macias Date: Sun, 13 Dec 2015 11:56:35 -0700 Subject: [PATCH] initial commit of nerpack plugin --- plugins/NerdPack.plg | 146 ++++++++++++ plugins/NerdPack.png | Bin 0 -> 9384 bytes source/NerdPack/install/doinst.sh | 1 + source/NerdPack/install/slack-desc | 19 ++ source/NerdPack/pkg_build.sh | 37 +++ .../emhttp/plugins/NerdPack/NerdPack.page | 38 ++++ .../local/emhttp/plugins/NerdPack/README.md | 5 + .../emhttp/plugins/NerdPack/event/started | 2 + .../plugins/NerdPack/icons/NerdPack.png | Bin 0 -> 744 bytes .../plugins/NerdPack/images/NerdPack.png | Bin 0 -> 9384 bytes .../NerdPack/include/DownloadHelpers.php | 76 +++++++ .../NerdPack/include/PackageDownload.php | 46 ++++ .../plugins/NerdPack/include/PackageQuery.php | 53 +++++ .../NerdPack/include/PackageUpdate.php | 38 ++++ .../NerdPack/javascript/jquery.NerdPack.js | 215 ++++++++++++++++++ .../plugins/NerdPack/scripts/packagemanager | 111 +++++++++ 16 files changed, 787 insertions(+) create mode 100644 plugins/NerdPack.plg create mode 100644 plugins/NerdPack.png create mode 100644 source/NerdPack/install/doinst.sh create mode 100644 source/NerdPack/install/slack-desc create mode 100755 source/NerdPack/pkg_build.sh create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/README.md create mode 100755 source/NerdPack/usr/local/emhttp/plugins/NerdPack/event/started create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/icons/NerdPack.png create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/images/NerdPack.png create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/DownloadHelpers.php create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageDownload.php create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageQuery.php create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageUpdate.php create mode 100644 source/NerdPack/usr/local/emhttp/plugins/NerdPack/javascript/jquery.NerdPack.js create mode 100755 source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager diff --git a/plugins/NerdPack.plg b/plugins/NerdPack.plg new file mode 100644 index 00000000..78918812 --- /dev/null +++ b/plugins/NerdPack.plg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + +]> + + + + +###2015.12.13 +- initial commit of wrapper plugin for packages in repo +###2015.12.07 +- Added perl 5.22.0 +- Added vim 7.4.898 (thanks Ryan Detzel) + +###2015.09.09 +- Keep all packages installed after NerdPack uninstall so we don't break other plugin's dependancies. (thanks David Coppit) + +###2015.08.09 +- Added p7zip 9.38.1 + +###2015.07.31 +- Added iperf 3.0.11 + +###2015.06.27 +- Added sshfs 2.5 + +###2015.06.23 +- Added python 2.7.9 (fixes iotop dependency) + +###2015.05.16 +- Added subversion 1.7.16 +- Added MD5 checks for all packages + +###2015.05.15 +- Added lftp 4.6.1 +- Replaced installpkg with upgradepkg to allow package upgrading +- Added removal of packages upon uninstall of &name; + +###2015.04.29 +- Added git 2.3.5 + +###2015.04.24 +- Added strace 4.10 + +###2015.04.23 +- Added bwm-ng 0.6 + +###2015.02.07 +- Added unrar 5.2.5 + +###2015.01.06 +- Inital release. includes: + - iftop 1.0pre2 + - iotop 0.6 + - screen 4.2.1 + - lshw B.02.17 + - kbd 1.15.3 + - inotify-tools 3.14 + - cpio 2.11 + + + + +&gitURL;/archive/&plgname;.txz + + + + +&gitURL;/archive/&plgname;.md5 + + + + + +if [ ! -d &emhttp; ]; then + mkdir -p &emhttp; +fi + +# Verify and install plugin package +sum1=$(/usr/bin/md5sum &plgpath;/&plgname;.txz) +sum2=$(/usr/bin/cat &plgpath;/&plgname;.md5) +if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then + echo "Wrong 'plugin' package md5 hash." + rm &plgpath;/&plgname;.txz \ + &plgpath;/&plgname;.md5 + exit 1 +else + upgradepkg --install-new &plgpath;/&plgname;.txz +fi + +# Update file permissions of scripts +chmod +0755 &emhttp;/scripts/* + +# Cleaning old source files +find &plgpath;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete +find &plgpath;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete + +echo "" +echo "-----------------------------------------------------------" +echo " &name; has been installed." +echo " This plugin requires Dynamix webGui to operate" +echo " Copyright 2015, &author;, eschultz" +echo " Version: &version;" +echo "-----------------------------------------------------------" +echo "" + + + + + + +removepkg &plgpath;/&plgname;.txz \ + &plgpath;/&pkg; +rm -rf &emhttp; \ + -rf &plgpath; + +echo "" +echo "-----------------------------------------------------------" +echo " &name; has been removed." +echo " Copyright 2015, &author;, eschultz" +echo " Version: &version;" +echo "-----------------------------------------------------------" +echo "" + + + + diff --git a/plugins/NerdPack.png b/plugins/NerdPack.png new file mode 100644 index 0000000000000000000000000000000000000000..6044749cba3247e2ef5d84a870fbce3015b61b8a GIT binary patch literal 9384 zcmcgy2Y6IfzW?3nEi;qe2qX}C2qZKWP-!YC0To2Sj>@XL$l~I2L0n{ASCOLF9>|KY z3bUqg+SWm@YvF zAZ*ed6Yin!5cX(P^qwj6{GC49`FA|}3IG3i4GK09tP zkc>$a#!mm8QW%nY>LShf&&uJ$hkrAGpSQin=eB=;^TPl3#G^-#A}8l4jvhVMf$GB# z*LT!&cdf;NO^Z6(ohwJaSdN`LzwX?Hef#!xY5!Ln-|anstP-gM$CB6H#=5oZ1lF-^ z*)km6xf(xj`x_s>nERvRr>(EX6&~K9?pP42Z20y9wr}4d%g)Z`YtNt0|K*gcw)y0% zj$EfR=bLwN!(G4cn00dZ+GIm`oVCx$sjVMY?-uo+Zx<9V;&?)lJEQY zPfI-x>#Z`GqFAodo>Zv~$MvS@qG4I{n>qkdrP?bYQ6=EWSMS1*dMgGEO6xq_rT%X- zaO@bFiA*Vs7?#1se(1AT;@xe{Px(ELCk2`Ok}<0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ua|xh^6Sbko*h`Y@4fh*-Q31jkIwH68(TE~-nsufpl^?D;pQl|&*0?@ zncv{dq3z9Uet(sLYp$Y!FIy#5*_ws-N=*e5172JIR#{@x*t;J6F}YXI?Ww7~D`|>I zQe<}4rJOu*Ja*gG&Hc&wdnG3KvrnBh_fYSo*qZi9d1p@{EuHSy{=Z6rS5j~N?2F{w p+~d*z3C_PSeHkZDo%pvw%-%3GD|zQD@3V!ICT30ea@?cK{tx>(O)&rf literal 0 HcmV?d00001 diff --git a/source/NerdPack/install/doinst.sh b/source/NerdPack/install/doinst.sh new file mode 100644 index 00000000..1a248525 --- /dev/null +++ b/source/NerdPack/install/doinst.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/source/NerdPack/install/slack-desc b/source/NerdPack/install/slack-desc new file mode 100644 index 00000000..53dca856 --- /dev/null +++ b/source/NerdPack/install/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +nerdapck: Nerd Tools unRAID Plugin +nerdpack: +nerdpack: unRAID plugin wrapper for extra packages, mostly CLI, for advanced +nerdpack: users. Use at your own risk. Not officially supported by LimeTech. +nerdpack: +nerdpack: Supports: apr, apt-util, bwm-ng, cpio, git, iftop, inotify, iotop, +nerdpack: iperf, kbd, lftp, lshw, neon, p7zip, perl, python, readline, screen, +nerdpack: sshfs-fuse, strace, subversion, unrar, utempter, vim +nerdpack: +nerdpack: plugin: https://github.com/dmacias72/unRAID-plugins +nerdpack: packages: https://github.com/eschultz/unraid6-nerdpack diff --git a/source/NerdPack/pkg_build.sh b/source/NerdPack/pkg_build.sh new file mode 100755 index 00000000..68a24194 --- /dev/null +++ b/source/NerdPack/pkg_build.sh @@ -0,0 +1,37 @@ +#!/bin/bash +DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" +tmpdir=/tmp/tmp.$(( $RANDOM * 19318203981230 + 40 )) +plugin=$(basename ${DIR}) +archive="$(dirname $(dirname ${DIR}))/archive" +version=$(date +"%Y.%m.%d") +package="${archive}/${plugin}-${version}-x86_64-1.txz" +md5="${archive}/${plugin}-${version}-x86_64-1.md5" + +if [[ -f $package ]]; then + for x in a b c d e d f g h ; do + package="${archive}/${plugin}-${version}${x}-x86_64-1.txz" + md5="${archive}/${plugin}-${version}${x}-x86_64-1.md5" + if [[ ! -f $package ]]; then + break + fi + done +fi + +mkdir -p $tmpdir +cd "$DIR" +cp --parents -f $(find . -type f ! \( -iname "pkg_build.sh" -o -iname "sftp-config.json" -o -iname ".DS_Store" \) ) $tmpdir/ +cd "$tmpdir/" +makepkg -l y -c y "${package}" +cd "$archive/" +md5sum $(basename "$package") > "$md5" +rm -rf "$tmpdir" + +# Verify and install plugin package +sum1=$(md5sum "${package}") +sum2=$(cat "$md5") +if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then + echo "Checksum mismatched."; + rm "$md5" "${package}" +else + echo "Checksum matched." +fi \ No newline at end of file diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page new file mode 100644 index 00000000..f4ff52a3 --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page @@ -0,0 +1,38 @@ +Icon="NerdPack.png" +Menu="NetworkServices" +Title="Nerd Pack" +--- + + + + +
+ + + + + + + + + + + + + + +
Name Version Size (kB) Downloaded Installed
+ +  +: +
+ + + diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/README.md b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/README.md new file mode 100644 index 00000000..f6abc852 --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/README.md @@ -0,0 +1,5 @@ +**Nerd Tools** + +Extra packages, mostly CLI, for advanced users. Use at your own risk. Not officially supported by LimeTech. + +Contains: iftop, iotop, screen, lshw, kbd, inotify-tools, cpio, unrar, bwm-ng, strace, git, lftp, subversion, python, sshfs, iperf, p7zip diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/event/started b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/event/started new file mode 100755 index 00000000..653b888e --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/event/started @@ -0,0 +1,2 @@ +#!/bin/bash +/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/icons/NerdPack.png b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/icons/NerdPack.png new file mode 100644 index 0000000000000000000000000000000000000000..96cbbd40d221fec0c8f1b3cb7f21e56a1b8085e9 GIT binary patch literal 744 zcmVP)|{m(ZfYlMhKZ^ zS&J5}DtbVqv?$0Pi=r}AB1#%F3!RF5k`?sQ#8T9zGGYeP#(U@fPYZD{aoe{%eBY1r zaSr@1#l=NA04qTL)~r*T*QS+B=hLPR7AM4KojtU+NdtVt`p?S8?~WC0PAf+VA__4T z-aqp7LRD*iM`!<&AYgT7a_-?B8Fw^I(-2{QX+6DzKd7sFNKa!q^J2phr4S{EQVfmA z=fX4h60Cq_+lFOF_T?_Qil8BaXK0vPwXd*PEDQ|vbHAa37<(A~9xuZqW9Wo-7MIo} zO|1}e`(&>1@yiboaDM{B--{z53zw^gLtD}TVf!v80o`Efri)fU1p(2~(RO!rkx!W> zFP^<8GVqe!B{uxsJ|fnSQhRwPb7H~~Q$Q5D-_V_T*TO6lfQHJwUNH^C3{ZEonGcdj zWAg!Ktnpz60=(`1h3EmqFi^U|A|t}_c)roq*~R(|>u76j z;ab&m7Dd_+Wpb~*?^tky3AvlPAEeKnS$wCenlW9+RqMk4$4}ydL|WV0@p`=|GYL^@ z`tOU6iCmcCh!>yFCsUQ3og*t&td#48PDzfB&YGS8j6RBz<{MG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F+1Dcx+sH|7Os0|<`RpfRrg-P|NnufnPbYk|$S1i6p$92^* zHS@DsaZ>h63c-~kQ+ri}i9qQ{sdSOoD&dJcHTY_`9}hqLDC+8Jv2fuF*FXiBjYgEa z_3)7EM1t zkkL8@f}O@lHXIh^gn*rHtpk1iCH^OVJnwp|?9j1`*X7{4J`nKKh%&)TNQii5H;j0O zoJTb#Jt_eK2FGEnTXWR3@e>*u#r`kA9Jr&Vp-1;bIGrw>I(Y)8X}6l2o7-{SZq^fe z29H^aj9zYnPuGgI&D~KZ-i-z!Qz6()(+&EjVpF*Pb(%%0zjnDUGp$~Sr1J<+w-HkM z%?k=*fY~prGlvj}NxF6OG?<`p7GufFFVl8|DK5}KbZ7L9Ei%%I9MQ3EiVYG1E;-KD zrJzhRhkT*oKUunbph}HopHwS8A`)`c-=?KKK$+Z+?|8 z8&3y}XE(mx+j8O1t%Bb&+U=KI)jA(+et^4 z=;x$>oHl@7ua|xh^6Sbko*h`Y@4fh*-Q31jkIwH68(TE~-nsufpl^?D;pQl|&*0?@ zncv{dq3z9Uet(sLYp$Y!FIy#5*_ws-N=*e5172JIR#{@x*t;J6F}YXI?Ww7~D`|>I zQe<}4rJOu*Ja*gG&Hc&wdnG3KvrnBh_fYSo*qZi9d1p@{EuHSy{=Z6rS5j~N?2F{w p+~d*z3C_PSeHkZDo%pvw%-%3GD|zQD@3V!ICT30ea@?cK{tx>(O)&rf literal 0 HcmV?d00001 diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/DownloadHelpers.php b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/DownloadHelpers.php new file mode 100644 index 00000000..4b4fd248 --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/DownloadHelpers.php @@ -0,0 +1,76 @@ + $previousProgress){ + $previousProgress = $progress; + + $pct=(double)($progress/100); + + $bar=round($pct * 30); + + $pct_disp=number_format($pct * 100, 0); + + $status_bar="\r["; + $status_bar.=str_repeat("|", $bar); + if($bar < 30){ + $status_bar.=">"; + $status_bar.=str_repeat("-", 30 - $bar); + } else { + $status_bar.="|"; + } + + $status_bar.="] $pct_disp%"; + + echo $status_bar; + + flush(); + + if($progress == 100) { + echo "\n"; + } + } + flush(); +} + +function get_file_from_url($file, $url) { + flush(); + $chfile = fopen($file, 'w'); + $ch = curl_init(); + $ch_vers = curl_version(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 3600); + curl_setopt($ch, CURLOPT_NOPROGRESS, false ); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_USERAGENT, 'curl/' . $ch_vers['version'] ); + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progressBar' ); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_FILE, $chfile ); + curl_exec($ch); + curl_close($ch); + fclose($chfile); + flush(); +} + +function get_content_from_github($repo, $file){ + flush(); + $ch = curl_init(); + $ch_vers = curl_version(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); + curl_setopt($ch, CURLOPT_USERAGENT, 'curl/' . $ch_vers['version'] ); + curl_setopt($ch, CURLOPT_URL, $repo); + $content = curl_exec($ch); + curl_close($ch); + if (!empty($content)) + file_put_contents($file, $content); + flush(); +} +?> diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageDownload.php b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageDownload.php new file mode 100644 index 00000000..e0ed5550 --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageDownload.php @@ -0,0 +1,46 @@ + diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageQuery.php b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageQuery.php new file mode 100644 index 00000000..cf744e3b --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageQuery.php @@ -0,0 +1,53 @@ + 4){ //if package name has a subset get it + for ($ii = 1; $ii < sizeof($pkg_NameArray)-3; $ii++) { + $pkg_Name = $pkg_Name."-".$pkg_NameArray[$ii]; + } + } + + $pkg_version = $pkg_NameArray[sizeof($pkg_NameArray)-3]; // get package version + + $pkg_nver = $pkg_Name."-".str_replace(".", "_", $pkg_version); // add underscored version to package name + + $pkg = array(); + + $pkg["name"] = $pkgs_github[$i]["name"]; // add full package name + + $pkg["pkgname"] = $pkg_Name; // add package name only + + $pkg["pkgnver"] = $pkg_nver; // add package name with underscored version + + $pkg["size"] = $pkgs_github[$i]["size"]; // add package size + + $pkg["installed"] = in_array( pathinfo($pkgs_github[$i]["name"], PATHINFO_FILENAME), $pkgs_installed ) ? "yes" : "no"; // checks if package is installed + + $pkg["downloaded"] = in_array( $pkgs_github[$i]["name"], $pkgs_downloaded ) ? "yes" : "no"; // checks if package is downloaded + + $pkg["config"] = isset($pkg_cfg["$pkg_nver"]) ? $pkg_cfg["$pkg_nver"] : "no"; // checks config for install preference + + $pkgs_array[] = $pkg; +} + +echo json_encode($pkgs_array); +?> \ No newline at end of file diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageUpdate.php b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageUpdate.php new file mode 100644 index 00000000..220de3db --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/include/PackageUpdate.php @@ -0,0 +1,38 @@ + diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/javascript/jquery.NerdPack.js b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/javascript/jquery.NerdPack.js new file mode 100644 index 00000000..1dbff1b5 --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/javascript/jquery.NerdPack.js @@ -0,0 +1,215 @@ +$(function(){ + //tablesorter options + $('#tblPackages').tablesorter({headers:{5:{sorter:false}}}); + + // "uninstall package" switch and cookie + $('#removepkg') + .switchButton({ + labels_placement: "right", + on_label: 'uninstall packages On', + off_label: 'uninstall packages Off', + checked: $.cookie('nerdpack_packages') == 'remove' + }) + .change(function () { + $.cookie('nerdpack_packages', $('#removepkg').prop('checked') ? 'remove' : 'donotremove', { expires: 3650 }); + }); + + // select all packages switch + $('#checkall') + .switchButton({ + labels_placement: "right", + on_label: 'select all', + off_label: ' select all', + checked: $.cookie('nerdpack_checkall') == 'yes' + }) + .change(function() { //on change + if(this.checked) { // check select status + $('.pkgcheckbox').each(function() { //loop through each checkbox + $(this).switchButton({checked: true}); + }); + $('.pkgvalue').each(function() { //loop through each value + $(this).val('yes'); + }); + }else{ + $('.pkgcheckbox').each(function() { //loop through each checkbox + $(this).switchButton({checked: false}); + }); + $('.pkgvalue').each(function() { //loop through each value + $(this).val('no'); + }); + } + }); + + // set cookie on apply button press + $('#btnApply').click(function(event) { + $.cookie('nerdpack_checkall', $('#checkall').prop('checked') ? 'yes' : 'no', { expires: 3650 }); + packageManager(); + }); + + packageQuery(); +}); + +function packageManager() { + $.ajax({ + type : "POST", + url : "/update.php", + data : $('#package_form').serializeArray(), + success: function() { + openBox('/plugins/NerdPack/scripts/packagemanager&arg1=webgui&arg2='+$.cookie('nerdpack_packages'),'Install Packages',490,430,true); + } + }); +}; + +//list all available packages in a table +function packageQuery() { + $.ajax({ + type: "GET", + dataType: "json", + url: "/plugins/NerdPack/include/PackageQuery.php", + success: function(data) { + if (data.length > 1){ + for( i in data ) { + $("#tblPackages tbody").append( + ""+ + ""+data[i].name+""+ //package name + ""+ //package status + ""+(data[i].size / 1000).toFixed(0)+""+ //package size + ""+data[i].downloaded+""+ //package installed + ""+data[i].installed+""+ //package installed + ""+ + ""+ + ""); + $('#'+data[i].pkgname) + .switchButton({ + labels_placement: 'right', + on_label: 'On', + off_label: 'Off', + checked: data[i].config == "yes" + }) + .change(function() { + var par = $(this).parent().parent(); + if(this.checked) + par.find('.pkgvalue').val("yes"); + else + par.find('.pkgvalue').val("no"); + $("#btnApply").prop("disabled", false); + checkDepends(); + }); + } + }else { + $("#tblPackages tbody").append( + ""+ + ""+ + ""); + + } + }, + complete : function () { + $("#tblPackages").trigger("update"); + packageCheck() + }, + error: function () { + } + }); +}; + +// check github for newer package and report status +function packageCheck() { + $.ajax({ + type: "GET", + url: "/boot/config/plugins/NerdPack/packages.json", + dataType: "json", + success: function(data) { + $('#tblPackages tbody tr').each(function(row, tr) { + var tblPackage = $(tr).children("td:nth-child(1)").html(); + var tblName = $(tr).children("td:nth-child(6)").find('.pkgcheckbox').attr("id"); + for( i in data ) { + var Package = data[i].name; + var pkgNameArray = Package.split('-'); + var pkgName = pkgNameArray[0]; + if (pkgNameArray.length > 4){ + for( var ii = 1; ii < pkgNameArray.length-3; ii++ ) { + pkgName = pkgName+"-"+pkgNameArray[ii]; + } + } + if ( tblName == pkgName){ + if (tblPackage == Package) + var Update = " up-to-date"; + else + var Update = " update ready"; + } + } + $(tr).children("td:nth-child(2)").html(Update); + }); + + }, + complete : function () { + $("#tblPackages").trigger("update"); + }, + error: function () { + } + }); +}; + +// update packages +function packageUpdate(pkgName, pkgOld, pkgNew, pkgSha) { + $.ajax({ + type: "POST", + dataType: "json", + url: "/plugins/NerdPack/include/PackageUpdate.php", + data: {pkgname: pkgName, pkgold: pkgOld, pkgnew: pkgNew, pkgsha: pkgSha}, + success: function(data) { + alert(data); + }, + complete : function () { + //location.reload(); + }, + error: function () { + } + }); +}; + +function downloadPackages() { + $.ajax({ + type: "POST", + url: "/plugins/NerdPack/include/PackageDownload.php", + dataType: "json", + success: function(data) { + for( i in data ) { + packageUpdate(null,null,data[i].name,data[i].sha); + } + }, + complete : function () { + $("#tblPackages").trigger("update"); + }, + error: function () { + } + }); +}; + + +function checkDepends() { + if ($('#screen').prop('checked') == true){ + $('#utempter').switchButton({checked: true}); + $('#utempter','.pkgvalue').val('yes'); + } + if ($('#iotop').prop('checked') == true){ + $('#python').switchButton({checked: true}); + $('#python','.pkgvalue').val('yes'); + } +}; + +// check github for newer package and report status +function getPackages() { + $.ajax({ + type: "GET", + url: "https://api.github.com/repos/eschultz/unraid6-nerdpack/contents/packages", + dataType: "json", + success: function(data) { + }, + complete : function () { + }, + error: function () { + } + }); +}; \ No newline at end of file diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager new file mode 100755 index 00000000..46c00cfa --- /dev/null +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager @@ -0,0 +1,111 @@ +#!/usr/bin/php -q + $pkg_pref) { //get preferences for each package + + $pkg_cmd = ''; + + $pkg_name = str_replace("_", ".", $pkg_name); // replace "_" with "." in package names + + $pkg_pattern = "/^".$pkg_name.".*/"; // search patter for packages + + $pkg_install_status = preg_grep($pkg_pattern, $pkgs_installed); // check install status + + if($pkg_pref == "yes" && !$pkg_install_status){ + + //if executing from the wegui check status and download if necessary + if ($argv[1] == "webgui"){ + + if(!preg_grep($pkg_pattern , $pkgs_downloaded)) { + + $pkg_online_status = preg_grep($pkg_pattern , $pkgs_github); + + $pkg_matches = array_filter($pkgs_github, function($a) use($pkg_pattern ) { + return preg_grep($pkg_pattern , $a); + }); + + $pkg_gitname = array_values($pkg_matches)[0]["name"]; + + $pkg_file = $pkg_path.$pkg_gitname; + + $pkg_url = array_values($pkg_matches)[0]["download_url"]; + + $pkg_sha = array_values($pkg_matches)[0]["sha"]; + + $pkg_size = array_values($pkg_matches)[0]["size"]; + + logger("Downloading $pkg_gitname package..."); + get_file_from_url($pkg_file, $pkg_url); + + /*$pkg_msg = "$pkg_name package download failed."; + if (file_put_contents($pkg_new, fopen($pkg_git.$pkg_name, 'r')));{ + $pkg_size = filesize($pkg_new); + $pkg_handle = fopen($pkg_new, "rb"); + $pkg_contents = fread($pkg_handle, $pkg_size); + fclose($pkg_handle); + $pkg_str = "blob ".$pkg_size."\0".$pkg_contents; + $pkg_sha = sha1($pkg_str); + if($pkg_sha == $_POST["pkgsha"]) { + $pkg_msg = "$pkg_name package downloaded."; + if (is_file($pkg_old)) + unlink($pkg_old); + if($pkg_pref == "yes") { + $pkg_msg = "$pkg_name package updated."; + } + }else { + if (is_file($pkg_new)) + unlink($pkg_new); + } + } + echo json_encode($pkg_msg); + */ + + } + } + + $pkg_msg = "Installing"; + $pkg_cmd = "upgradepkg --install-new "; + + }elseif($pkg_pref == "no" && $pkg_install_status && $argv[2] == "remove"){ + + $pkg_msg = "Removing"; + $pkg_cmd = "removepkg "; + + } + if(!empty($pkg_cmd)){ + logger("$pkg_msg $pkg_name package..."); + $pkg_cmd = $pkg_cmd.$pkg_path.$pkg_name."*"; + + exec($pkg_cmd, $output, $return_var); + + for ($i = 0; $i < sizeof($output); $i++) { + logger($output[$i]); + } + } +} + +logger("All packages processed"); +?> \ No newline at end of file