Skip to content

Commit

Permalink
Add back hardcoded self-protection of dnf
Browse files Browse the repository at this point in the history
Now that obsoletion of protected packages is allowed
(rpm-software-management#1610), it's best
to hardcode the protection of dnf here instead of using the file in
/etc/dnf/protected.d. This way, DNF 4 cannot uninstall itself, but DNF 5
can uninstall DNF 4, and likewise (given a similar change in DNF 5), DNF
5 cannot uninstall itself, but DNF 4 can uninstall DNF 5.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2221905
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2221907

= changelog =
msg: Allow dnf to be removed by DNF 5
type: enhancement
  • Loading branch information
evan-goode committed Sep 21, 2023
1 parent 10958ca commit 913ace4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libdnf/conf/ConfigMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ class ConfigMain::Impl {
}
};

OptionStringList protected_packages{resolveGlobs("glob:/etc/yum/protected.d/*.conf " \
"glob:/etc/dnf/protected.d/*.conf")};
OptionStringList protected_packages{resolveGlobs("dnf " \
"glob:/etc/yum/protected.d/*.conf " \
"glob:/etc/dnf/protected.d/*.conf")};
OptionString username{""};
OptionString password{""};
OptionBool gpgcheck{false};
Expand Down

0 comments on commit 913ace4

Please sign in to comment.