0c0426 Enable PowerTools repo in %post

Authored and Committed by Michel Alexandre Salim a year ago
    Enable PowerTools repo in %post
    
    This is needed by some EPEL RPMs and potentially some Hyperscale RPMs as well;
    flip this on if it is disabled.
    
    We can safely assume this is running on CentOS Stream (there's an explicit
    `Requires:` on `centos-stream-release`), and we check that the repo file exists,
    and make sure it only contains `_one_` `enabled=` line before modifying.
    
    ```
    [vagrant@localhost ~]$ dnf repolist enabled
    repo id               repo name
    appstream             CentOS Stream 8 - AppStream
    baseos                CentOS Stream 8 - BaseOS
    centos-hyperscale     CentOS Stream 8 - Hyperscale
    epel                  Extra Packages for Enterprise Linux 8 - x86_64
    epel-modular          Extra Packages for Enterprise Linux Modular 8 - x86_64
    extras                CentOS Stream 8 - Extras
    [vagrant@localhost ~]$ sudo dnf install /vagrant/centos-release-hyperscale-4-2.e
    l8.noarch.rpm
    Last metadata expiration check: 0:03:52 ago on Wed 19 May 2021 11:40:35 PM UTC.
    Dependencies resolved.
    ================================================================================
     Package                       Arch       Version        Repository        Size
    ================================================================================
    Upgrading:
     centos-release-hyperscale     noarch     4-2.el8        @commandline     9.6 k
    
    Transaction Summary
    ================================================================================
    Upgrade  1 Package
    
    Total size: 9.6 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Upgrading        : centos-release-hyperscale-4-2.el8.noarch               1/2
      Running scriptlet: centos-release-hyperscale-4-2.el8.noarch               1/2
      Cleanup          : centos-release-hyperscale-4-1.el8.noarch               2/2
      Verifying        : centos-release-hyperscale-4-2.el8.noarch               1/2
      Verifying        : centos-release-hyperscale-4-1.el8.noarch               2/2
    
    Upgraded:
      centos-release-hyperscale-4-2.el8.noarch
    
    Complete!
    [vagrant@localhost ~]$ dnf repolist enabled
    repo id               repo name
    appstream             CentOS Stream 8 - AppStream
    baseos                CentOS Stream 8 - BaseOS
    centos-hyperscale     CentOS Stream 8 - Hyperscale
    epel                  Extra Packages for Enterprise Linux 8 - x86_64
    epel-modular          Extra Packages for Enterprise Linux Modular 8 - x86_64
    extras                CentOS Stream 8 - Extras
    powertools            CentOS Stream 8 - PowerTools
    ```
    
    Signed-off-by: Michel Alexandre Salim <salimma@centosproject.org>