Merge pull request #79 from jsavargas/main

remove old packages when upgrading
This commit is contained in:
Jonathan Salinas Vargas 2023-06-07 18:03:29 -04:00 committed by GitHub
commit 20679524e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

Binary file not shown.

View File

@ -3,8 +3,8 @@
<!DOCTYPE PLUGIN [
<!ENTITY name "NerdTools">
<!ENTITY author "UnRAIDES">
<!ENTITY version "2023.05.15">
<!ENTITY md5 "3889611a8bc7b02d3d92b13ffb5c8f24">
<!ENTITY version "2023.06.07">
<!ENTITY md5 "0b761463e59a198deab64b45b731b64f">
<!ENTITY launch "Settings/&name;">
<!ENTITY github "UnRAIDES/unRAID-&name;">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/plugin/&name;.plg">
@ -17,6 +17,8 @@
<CHANGES>
##&name;
###2023.06.07
- Enhanced: remove old packages when upgrading
###2023.05.15
- Enhanced: PHP8 optimization
- Enhanced: autoinstall of the dependencies

View File

@ -67,7 +67,7 @@ foreach ($pkgs_github_array as $pkg_github) {
$pkg = [
'name' => str_replace("_nerdtools.txz",".txz",$pkg_github['name']) , // add full package name
'dependencies' => $depends_file_array[$pkg_name] ?? "" ? str_replace(array(" ",","), array("",", "), $depends_file_array[$pkg_name]) : '',
'dependencies' => isset($depends_file_array[$pkg_name]) ? str_replace(array(" ",","), array("",", "), $depends_file_array[$pkg_name]) : '', // add package name only
'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

View File

@ -137,6 +137,11 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
if (!empty($pkg_cmd)) {
logger("$pkg_msg $pkg_name package...");
shell_exec($pkg_cmd);
$name = explode("-", $pkg_name)[0] ?? "";
if ($name) {
$find_rm_old ="find ".$pkg_extra_path." -type f ! -name '$pkg_name*' -name '".explode("-", $pkg_name)[0]."-*' -delete";
shell_exec($find_rm_old);
}
}else{
if ($pkg_pref == 'yes'){
if (file_exists($pkg_file)){
@ -157,8 +162,8 @@ foreach ($pkg_cfg as $pkg_name => $pkg_pref) { // get preferences for each packa
}
logger('Cleaning up packages...');
#$cmd = "find ".$pkg_extra_path." -type f ! -name 'packages.json' ! -name 'packages-desc'".$pkg_find." -delete 2>&1";
#shell_exec($cmd);
$cmd = 'find '.$pkg_extra_path.' -type f '.$pkg_find.' -name "*nerdtools*" -delete 2>&1';
shell_exec($cmd);
logger('All packages processed...');