mirror of
https://github.com/UnRAIDES/unRAID-NerdTools
synced 2025-04-05 14:51:31 +00:00
Merge pull request #21 from jsavargas/update-ready
update-ready && plugin column
This commit is contained in:
commit
dda0b39de5
BIN
archive/NerdTools-2022.10.08-x86_64-1.txz
Normal file
BIN
archive/NerdTools-2022.10.08-x86_64-1.txz
Normal file
Binary file not shown.
|
@ -3,8 +3,8 @@
|
|||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "NerdTools">
|
||||
<!ENTITY author "UnRAIDES">
|
||||
<!ENTITY version "2022.10.06">
|
||||
<!ENTITY md5 "13ef1692a3259f149692fa213e39f5b1">
|
||||
<!ENTITY version "2022.10.08">
|
||||
<!ENTITY md5 "ff03dec047f1f450025e046dcad18be9">
|
||||
<!ENTITY launch "Settings/&name;">
|
||||
<!ENTITY github "UnRAIDES/unRAID-&name;">
|
||||
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/plugin/&name;.plg">
|
||||
|
@ -17,6 +17,9 @@
|
|||
|
||||
<CHANGES>
|
||||
##&name;
|
||||
###2022.10.08
|
||||
- The plugins column is changed by the current version
|
||||
- The functionality to compare old versions is updated
|
||||
###2022.10.05
|
||||
- Fix remove packages on uninstalling plugin
|
||||
###2022.10.04d
|
||||
|
@ -112,6 +115,7 @@ rm -f &plgPATH;/&plgNAME;.txz
|
|||
|
||||
removepkg /boot/extra/*_nerdtools.txz 1>/dev/null
|
||||
rm -f /boot/exta/*_nerdtools.txz 1>/dev/null
|
||||
rm -f /boot/config/plugins/NerdTools 1>/dev/null
|
||||
|
||||
echo ""
|
||||
echo "-----------------------------------------------------------"
|
||||
|
|
|
@ -28,7 +28,7 @@ table.tablesorter tbody tr:nth-child(even) {
|
|||
<th class="sorter-metric filter-false" data-placeholder="by size" data-metric-name-full="byte|Byte|BYTE" data-metric-name-abbr="b|B"> Size </th>
|
||||
<th class="filter-downloaded" data-placeholder="by download"> Downloaded </th>
|
||||
<th class="filter-installed" data-placeholder="by install"> Installed </th>
|
||||
<th class="filter-plugins" data-placeholder="Search..."> Plugins </th>
|
||||
<th class="filter-false" data-placeholder="Search..."> Installed Version </th>
|
||||
<th class="parser-false filter-false" nowrap="nowrap"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -6,7 +6,7 @@ function get_file_from_url($file, $url) {
|
|||
$ch_vers = curl_version();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
//curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
|
||||
curl_setopt($ch, CURLOPT_NOPROGRESS, true);
|
||||
curl_setopt($ch, CURLOPT_NOPROGRESS, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'curl/'.$ch_vers['version']);
|
||||
//curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progress_bar');
|
||||
|
|
|
@ -13,6 +13,7 @@ if (!is_dir($pkg_extra_path))
|
|||
|
||||
$pkg_desc = 'https://raw.githubusercontent.com/UnRAIDES/unRAID-NerdTools/main/packages/packages-desc';
|
||||
$pkg_repo = "https://api.github.com/repos/UnRAIDES/unRAID-NerdTools/contents/packages/$os_version";
|
||||
$pkg_repo = $_SERVER['HTTP_DEVELOP'] ? $pkg_repo = "https://api.github.com/repos/jsavargas/unRAID-NerdTools/contents/packages/$os_version?ref=develop" : $pkg_repo;
|
||||
|
||||
$desc_file = $pkg_path.'packages-desc';
|
||||
$repo_file = $pkg_path.'packages.json';
|
||||
|
|
|
@ -30,7 +30,7 @@ foreach ($pkgs_github_array as $pkg_github) {
|
|||
|
||||
$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_nver = $pkg_name.'-'.str_replace('.', '__', $pkg_version); // add underscored version to package name
|
||||
|
||||
$pkg_pattern = '/^'.$pkg_name.'-[0-9].*/'; // search pattern for packages
|
||||
|
||||
|
@ -56,16 +56,23 @@ foreach ($pkgs_github_array as $pkg_github) {
|
|||
}
|
||||
}
|
||||
|
||||
$downloadedpkg = !empty(preg_grep($pkg_pattern, $pkgs_installed)) ? array_values(preg_grep($pkg_pattern, $pkgs_installed))[0] : false;
|
||||
$downloadedpkgv = $downloadedpkg ? preg_match('/^'.$pkg_name.'-(\d.+?)[-|_].*/',$downloadedpkg, $matches)? $matches[1]:false : false;
|
||||
$updatePkg = version_compare($pkg_version, $downloadedpkgv, '>') ;
|
||||
|
||||
$pkg = [
|
||||
'name' => $pkg_github['name'], // add full package name
|
||||
'name' => str_replace("_nerdtools.txz",".txz",$pkg_github['name']) , // add full package name
|
||||
'pkgname' => $pkg_name, // add package name only
|
||||
'pkgnver' => $pkg_nver, // add package name with underscored version
|
||||
'pkgversion' => $pkg_version, // add package name with raw version
|
||||
'updatePkg' => $updatePkg, // add package name with raw version
|
||||
'updatePkgs' => "$pkg_version => $downloadedpkgv", // add package name with raw version
|
||||
'size' => format_size($pkg_github['size'], 1, '?'), // add package size
|
||||
'installed' => !empty(preg_grep($pkg_pattern, $pkgs_installed)) ? 'yes' : 'no', // checks if package name is installed
|
||||
'installeq' => in_array(pathinfo($pkg_github['name'], PATHINFO_FILENAME), $pkgs_installed) ? 'yes' : 'no', // checks if package installed equals github exactly
|
||||
'downloaded' => !empty(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
|
||||
'actualpkgv' => $downloadedpkgv ? $downloadedpkgv:" - ", // checks if package name is downloaded
|
||||
'config' => $pkg_set, // install preference
|
||||
'plugins' => $pkg_plgs, // plugins dependency on package
|
||||
'desc' => $pkgs_desc_array[$pkg_name]
|
||||
|
|
|
@ -41,7 +41,8 @@ function packageQuery(force) {
|
|||
var DownloadEQ = data.packages[i].downloadeq;
|
||||
var Installed = data.packages[i].installed;
|
||||
var InstallEQ = data.packages[i].installeq;
|
||||
if (DownloadEQ == Downloaded && InstallEQ == Installed){
|
||||
var updatePkg = data.packages[i].updatePkg;
|
||||
if (InstallEQ == Installed || !updatePkg){
|
||||
if (Installed == "yes"){
|
||||
if (Downloaded == "no")
|
||||
Update = "<span ><i class='installed fa fa-check-circle'></i> installed</span>";
|
||||
|
@ -55,7 +56,7 @@ function packageQuery(force) {
|
|||
Ready = true;
|
||||
}
|
||||
|
||||
if (DownloadEQ != Downloaded)
|
||||
if (DownloadEQ != Downloaded && updatePkg)
|
||||
Downloaded = 'old';
|
||||
|
||||
var Checked = "";
|
||||
|
@ -70,7 +71,7 @@ function packageQuery(force) {
|
|||
"<td>"+data.packages[i].size+"</td>"+ // package size
|
||||
"<td>"+Downloaded+"</td>"+ // package downloaded
|
||||
"<td>"+Installed+"</td>"+ // package installed
|
||||
"<td>"+data.packages[i].plugins+"</td>"+ // package dependents
|
||||
"<td>"+data.packages[i].actualpkgv+"</td>"+ // package dependents
|
||||
"<td><input class='pkgcheckbox' id='"+data.packages[i].pkgname+"' type='checkbox' "+Checked+">"+
|
||||
"<input class='pkgvalue' type='hidden' id='"+data.packages[i].pkgname+"_value' name='"+data.packages[i].pkgnver+"' value='"+data.packages[i].config+"'></td>"+
|
||||
"</tr>");
|
||||
|
|
|
@ -68,10 +68,11 @@ $pkg_find = '';
|
|||
foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each package
|
||||
$pkg_cmd = '';
|
||||
$pkg_msg = '';
|
||||
$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 pattern for packages
|
||||
$pkg_patternd = '/^'.$pkg_name.'.*_nerdtools.*/'; // search pattern for packages
|
||||
$pkg_install_status = !empty(preg_grep($pkg_pattern, $pkgs_installed)); // check install status
|
||||
$pkg_download_status = !empty(preg_grep($pkg_pattern, $pkgs_downloaded)); // check package download 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_find .= " ! -name '".$pkg_name."*'";
|
||||
|
||||
|
@ -95,6 +96,8 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
|
|||
logger(substr($plg_msg, 0, -2));
|
||||
}
|
||||
|
||||
$pkg_file = str_replace("_nerdtools.txz",".txz",$pkg_file);
|
||||
$pkg_file = str_replace(".txz","_nerdtools.txz",$pkg_file);
|
||||
// if package is selected to be installed
|
||||
if ($pkg_pref == 'yes') {
|
||||
// if executing from the wegui check status and download if necessary
|
||||
|
@ -120,7 +123,7 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
|
|||
|
||||
if (!$pkg_install_status) { // if package is not installed
|
||||
$pkg_msg = 'Installing';
|
||||
$pkg_cmd = 'upgradepkg --install-new '.$pkg_extra_path.$pkg_name.'* 2>&1';
|
||||
$pkg_cmd = 'upgradepkg --install-new '.$pkg_extra_path.$pkg_name.'*_nerdtools.txz 2>&1';
|
||||
}
|
||||
|
||||
} elseif ($pkg_pref == 'no' && $pkg_download_status && $argu) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user