update checking config file

This commit is contained in:
dmacias72 2016-03-14 23:48:54 -06:00
parent 9aea6152f6
commit 32d1f68bdf
3 changed files with 43 additions and 20 deletions

View File

@ -3,7 +3,7 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "NerdPack"> <!ENTITY name "NerdPack">
<!ENTITY author "dmacias72"> <!ENTITY author "dmacias72">
<!ENTITY version "2016.02.23"> <!ENTITY version "2016.03.14">
<!ENTITY launch "Settings/&name;"> <!ENTITY launch "Settings/&name;">
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unRAID-plugins/master"> <!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unRAID-plugins/master">
<!ENTITY pluginURL "&gitURL;/plugins/&name;.plg"> <!ENTITY pluginURL "&gitURL;/plugins/&name;.plg">
@ -16,6 +16,9 @@
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;"> <PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;">
<CHANGES> <CHANGES>
###2016.03.14
- update plugin for unRAID 6.2 compatibility
- update packages for 6.2
###2016.02.23 ###2016.02.23
- fix: search for a partial match of packages used in other plugins - fix: search for a partial match of packages used in other plugins
###2016.02.17 ###2016.02.17
@ -138,10 +141,11 @@ The 'tablesorter' package file.
<!-- <!--
The Github repo packages file. The Github repo packages file.
-->
<FILE Name="&plgpath;/packages/packages.json"> <FILE Name="&plgpath;/packages/packages.json">
<URL>&gitURL;/plugins/packages.json</URL> <URL>&gitURL;/plugins/packages.json</URL>
</FILE> </FILE>
-->
<!-- <!--
The package description file. The package description file.
@ -171,7 +175,8 @@ The 'install' script.
<INLINE> <INLINE>
#Verify unRAID Version #Verify unRAID Version
source /etc/unraid-version source /etc/unraid-version
if [[ ${version:0:3} == 6.0 ]]; then VER=${version:0:3}
if [[ $VER == 6.0 ]]; then
echo "unRAID version 6.1 or higher is required" echo "unRAID version 6.1 or higher is required"
exit 1 exit 1
fi fi
@ -185,13 +190,16 @@ if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
&plgpath;/&plgname;.md5 &plgpath;/&plgname;.md5
exit 1 exit 1
else else
upgradepkg --install-new &plgpath;/&plgname;.txz if [ ! -d &plgpath;/packages/$VER ]; then
mkdir &plgpath;/packages/$VER
fi fi
if [ ! -d &plgpath;/packages ]; then if [[ ${version:0:3} == 6.1 ]]; then
mkdir &plgpath;/packages mv &plgpath;/packages/*txz &plgpath;/packages/6.1
fi fi
upgradepkg --install-new &plgpath;/&plgname;.txz
/usr/sbin/packagemanager /usr/sbin/packagemanager
# Cleaning old source files # Cleaning old source files
@ -206,6 +214,7 @@ echo " Copyright 2016, &author;, eschultz"
echo " Version: &version;" echo " Version: &version;"
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
echo "" echo ""
fi
</INLINE> </INLINE>
</FILE> </FILE>

View File

@ -27,6 +27,7 @@ foreach ($pkgs_github_array as $pkg_github) {
$pkg_pattern = '/^'.$pkg_name.'.*/'; // search patter for packages $pkg_pattern = '/^'.$pkg_name.'.*/'; // search patter for packages
// check all plugins for package dependency
$plugins = []; $plugins = [];
exec("cd /boot/config/plugins ; find *.plg | xargs grep '${pkg_name}-${pkg_version}' -sl",$plugins); exec("cd /boot/config/plugins ; find *.plg | xargs grep '${pkg_name}-${pkg_version}' -sl",$plugins);
$pkg_plgs = '--'; $pkg_plgs = '--';
@ -37,6 +38,19 @@ foreach ($pkgs_github_array as $pkg_github) {
$pkg_plgs = substr($pkg_plgs, 2, -2); $pkg_plgs = substr($pkg_plgs, 2, -2);
} }
// get package preference from config file
$pkg_set = "no";
foreach ($pkg_cfg as $pkg_key => $pkg_line) {
if (preg_match('/^'.$pkg_name.'.*/',$pkg_key)){
if(sizeof(array_diff(split('-', $pkg_key), split('-', $pkg_name))) < 2 ){
$pkg_set = $pkg_line;
break;
}
}
}
//isset($pkg_cfg[$pkg_nver]) ? $pkg_cfg[$pkg_nver] : 'no'
$pkg = [ $pkg = [
'name' => $pkg_github['name'], // add full package name 'name' => $pkg_github['name'], // add full package name
'pkgname' => $pkg_name, // add package name only 'pkgname' => $pkg_name, // add package name only
@ -47,8 +61,8 @@ foreach ($pkgs_github_array as $pkg_github) {
'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly 'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly
'downloaded' => preg_grep($pkg_pattern, $pkgs_downloaded) ? 'yes' : 'no', // checks if package name is downloaded 'downloaded' => preg_grep($pkg_pattern, $pkgs_downloaded) ? 'yes' : 'no', // checks if package name is downloaded
'downloadeq' => in_array($pkg_github['name'], $pkgs_downloaded) ? 'yes' : 'no', // checks if package downloaded equals github exactly 'downloadeq' => in_array($pkg_github['name'], $pkgs_downloaded) ? 'yes' : 'no', // checks if package downloaded equals github exactly
'config' => isset($pkg_cfg[$pkg_nver]) ? $pkg_cfg[$pkg_nver] : 'no', // checks config for install preference 'config' => $pkg_set, // install preference
'plugins' => $pkg_plgs, // checks plugins dependency on package 'plugins' => $pkg_plgs, // plugins dependency on package
'desc' => $pkgs_desc_array[$pkg_name] 'desc' => $pkgs_desc_array[$pkg_name]
]; ];

View File

@ -54,7 +54,7 @@ logger('Processing Packages...');
foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package
$pkg_cmd = ''; $pkg_cmd = '';
$pkg_name = str_replace('_', '.', $pkg_name); // replace "_" with "." in package names $pkg_name = str_replace('_', '.', $pkg_name); // replace "_" with "." in package names
$pkg_pattern = '/^'.$pkg_name.'.*/'; // search patter for packages $pkg_pattern = '/^'.$pkg_name.'.*/'; // search pattern for packages
$pkg_install_status = preg_grep($pkg_pattern, $pkgs_installed); // check install status $pkg_install_status = preg_grep($pkg_pattern, $pkgs_installed); // check install status
$pkg_download_status = preg_grep($pkg_pattern, $pkgs_downloaded); // check package download status $pkg_download_status = preg_grep($pkg_pattern, $pkgs_downloaded); // check package download status