diff --git a/archive/NerdTools-2023.04.24-x86_64-1.txz b/archive/NerdTools-2023.04.24-x86_64-1.txz new file mode 100644 index 0000000..dd37239 Binary files /dev/null and b/archive/NerdTools-2023.04.24-x86_64-1.txz differ diff --git a/plugin/NerdTools.plg b/plugin/NerdTools.plg index 3a18cf6..54e52d6 100644 --- a/plugin/NerdTools.plg +++ b/plugin/NerdTools.plg @@ -3,8 +3,8 @@ - - + + @@ -17,6 +17,8 @@ ##&name; +###2023.04.24 +- Enhanced: improvements in package installation ###2023.03.30 - Enhanced: change category of the plugin (PR #50) ###2023.03.29 diff --git a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager index d366320..2bc3b12 100755 --- a/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager +++ b/source/NerdTools/usr/local/emhttp/plugins/NerdTools/scripts/packagemanager @@ -73,17 +73,24 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa $pkg_patternd = '/^'.$pkg_name.'.*_nerdtools.*/'; // search pattern for packages $pkg_install_status = !empty(preg_grep($pkg_patternd, $pkgs_installed)); // check install status $pkg_download_status = !empty(preg_grep($pkg_patternd, $pkgs_downloaded)); // check package download status - $pkg_online_status = !empty(preg_grep($pkg_pattern, $pkgs_github_array)); + #$pkg_online_status = !empty(preg_grep($pkg_pattern, $pkgs_github_array)); $pkg_find .= " ! -name '".$pkg_name."*'"; - $pkg_matches = array_filter($pkgs_github_array, function($a) use ($pkg_pattern) { - return preg_grep($pkg_pattern, $a); - }); + #$pkg_matches = array_filter($pkgs_github_array, function($a) use ($pkg_pattern) { + # return preg_grep($pkg_pattern, $a); + #}); - $pkg_gitname = array_values($pkg_matches)[0]['name']; + foreach ($pkgs_github_array as $item) { + if (preg_match($pkg_pattern, $item['name'])) { + $pkg_matches = $item; + break; + } + } + + $pkg_gitname = $pkg_matches['name']; $pkg_file = $pkg_extra_path.$pkg_gitname; - $pkg_url = array_values($pkg_matches)[0]['download_url']; - $pkg_sha1 = array_values($pkg_matches)[0]['sha']; + $pkg_url = $pkg_matches['download_url']; + $pkg_sha1 = $pkg_matches['sha']; //check if plugin is dependent on package $plugins = []; @@ -93,7 +100,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa foreach ($plugins as $plugin){ $plg_msg .= pathinfo($plugin, PATHINFO_FILENAME).", "; } - logger(substr($plg_msg, 0, -2)); + #logger(substr($plg_msg, 0, -2)); } $pkg_file = str_replace("_nerdtools.txz",".txz",$pkg_file); @@ -104,11 +111,6 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa if ($argd) { if (!$pkg_download_status) { //if package is not downloaded - //logger('Downloading '.$pkg_gitname.' package...', $argq); - //logger('Downloading pkg_file '.$pkg_file.' package...', $argq); - //logger('Downloading pkg_url '.$pkg_url.' package...', $argq); - //logger('Downloading pkg_sha1 '.$pkg_sha1.' package...', $argq); - get_file_from_url($pkg_file, $pkg_url); if (file_check_sha1($pkg_file, $pkg_sha1)){ @@ -144,12 +146,12 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa if(!is_dir($pkg_file)) unlink($pkg_file); $pkg_msg = 'checksum failed! package deleted.'; + logger($pkg_name." $pkg_msg", $argq); } }else{ $pkg_msg = ' package missing!'; + logger($pkg_name." $pkg_msg", $argq); } - - logger($pkg_name." $pkg_msg", $argq); } } }