feat(scan): Support RHEL8 (#813)
* feat(scan): Support RHEL8 * fix(scan): check if `dnf-uils` is installed
This commit is contained in:
@@ -47,15 +47,26 @@ func (o *centos) depsFast() []string {
|
||||
if o.getServerInfo().Mode.IsOffline() {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
// repoquery
|
||||
return []string{"yum-utils"}
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
if majorVersion < 8 {
|
||||
return []string{"yum-utils"}
|
||||
}
|
||||
return []string{"dnf-utils"}
|
||||
}
|
||||
|
||||
func (o *centos) depsFastRoot() []string {
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-plugin-ps",
|
||||
if o.getServerInfo().Mode.IsOffline() {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
// repoquery
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
if majorVersion < 8 {
|
||||
return []string{"yum-utils"}
|
||||
}
|
||||
return []string{"dnf-utils"}
|
||||
}
|
||||
|
||||
func (o *centos) depsDeep() []string {
|
||||
|
||||
@@ -363,7 +363,11 @@ func (o *redhatBase) scanUpdatablePackages() (models.Packages, error) {
|
||||
return nil, xerrors.Errorf("Failed to `yum makecache`: %w", err)
|
||||
}
|
||||
|
||||
cmd := `repoquery --all --pkgnarrow=updates --qf="%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{REPO}"`
|
||||
isDnf := o.exec(util.PrependProxyEnv(`repoquery --version | grep dnf`), o.sudo.repoquery()).isSuccess()
|
||||
cmd := `repoquery --all --pkgnarrow=updates --qf='%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{REPO}'`
|
||||
if isDnf {
|
||||
cmd = `repoquery --upgrades --qf='%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{REPONAME}' -q`
|
||||
}
|
||||
for _, repo := range o.getServerInfo().Enablerepo {
|
||||
cmd += " --enablerepo=" + repo
|
||||
}
|
||||
|
||||
@@ -53,7 +53,13 @@ func (o *rhel) depsFastRoot() []string {
|
||||
if o.getServerInfo().Mode.IsOffline() {
|
||||
return []string{}
|
||||
}
|
||||
return []string{"yum-utils"}
|
||||
|
||||
// repoquery
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
if majorVersion < 8 {
|
||||
return []string{"yum-utils"}
|
||||
}
|
||||
return []string{"dnf-utils"}
|
||||
}
|
||||
|
||||
func (o *rhel) depsDeep() []string {
|
||||
|
||||
Reference in New Issue
Block a user