@@ -455,23 +455,23 @@ func (rm *rpmManager) installUpdates(ctx context.Context, updates unversioned.Up
455455 if dnfTooling == "" {
456456 dnfTooling = rm .rpmTools ["dnf" ]
457457 }
458- checkUpdateTemplate := `sh -c "%[1]s check-update; if [ $? -eq 0 ]; then echo >> /updates.txt; fi"`
458+ checkUpdateTemplate := `sh -c "$( %[1]s -q check-update | wc -l) ; if [ $? -ne 0 ]; then echo >> /updates.txt; fi"`
459459 if ! rm .checkForUpgrades (ctx , dnfTooling , checkUpdateTemplate ) {
460460 return nil , nil , fmt .Errorf ("no patchable packages found" )
461461 }
462462
463463 const dnfInstallTemplate = `sh -c '%[1]s upgrade %[2]s -y && %[1]s clean all'`
464464 installCmd = fmt .Sprintf (dnfInstallTemplate , dnfTooling , pkgs )
465465 case rm .rpmTools ["yum" ] != "" :
466- checkUpdateTemplate := `sh -c 'if [ "$(%[1]s -q check-update | wc -l)" -eq 0 ]; then echo >> /updates.txt; fi'`
466+ checkUpdateTemplate := `sh -c 'if [ "$(%[1]s -q check-update | wc -l)" -ne 0 ]; then echo >> /updates.txt; fi'`
467467 if ! rm .checkForUpgrades (ctx , rm .rpmTools ["yum" ], checkUpdateTemplate ) {
468468 return nil , nil , fmt .Errorf ("no patchable packages found" )
469469 }
470470
471471 const yumInstallTemplate = `sh -c '%[1]s upgrade %[2]s -y && %[1]s clean all'`
472472 installCmd = fmt .Sprintf (yumInstallTemplate , rm .rpmTools ["yum" ], pkgs )
473473 case rm .rpmTools ["microdnf" ] != "" :
474- checkUpdateTemplate := `sh -c "%[1]s install dnf -y; dnf check-update -y; if [ $? -eq 0 ]; then echo >> /updates.txt; fi;"`
474+ checkUpdateTemplate := `sh -c "%[1]s install dnf -y; dnf check-update -y; if [ $? -ne 0 ]; then echo >> /updates.txt; fi;"`
475475 if ! rm .checkForUpgrades (ctx , rm .rpmTools ["microdnf" ], checkUpdateTemplate ) {
476476 return nil , nil , fmt .Errorf ("no patchable packages found" )
477477 }
0 commit comments