Existe um comando tudo-em-um para o RPM fazer o downgrade de um pacote para uma versão mais antiga?

2

Eu quero fazer o downgrade de alguns RPMs. Existe uma combinação de interruptores para isso? Por exemplo, ao fazer o upgrade, geralmente corro rpm -Uvh foo.rpm , mas entendo que a opção -U significa que ele só substitui o pacote se for mais antigo ... por isso não funcionará para downgrades.

    
por Mike B 27.08.2014 / 17:36

1 resposta

7

Usando RPM

Tente o seguinte:

$ rpm -Uvh --oldpackage pkg1.rpm pkg2.rpm

excerto da página de manual do rpm

   rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

   This upgrades or installs the package currently installed to a newer 
   version.  This is the same as install, except all other version(s) of the  
   package are removed after the new package is installed.

   --oldpackage
          Allow an upgrade to replace a newer package with an older one.

Usando o YUM + downgrade

Com yum você também deve poder fazer o seguinte:

$ yum downgrade /path/pkg1.rpm /path/pkg2.rpm

Usando o YUM + histórico desfazer

Se você instalou o pkgX-1.0 anteriormente e depois atualizou para o pkgX-1.1, você poderá usar yum history para ver esta atualização e yum history undo para reverter isso também.

trecho da página de manual do yum na história

The undo/redo/rollback commands take either a single transaction id or the keyword last and an offset from the last transaction (Eg. if you've done 250 transactions, "last" refers to transaction 250, and "last-4" refers to transaction 246). The redo command can also take some optional arguments before you specify the transaction. "force-reinstall" tells it reinstall any packages that were installed in that transaction (via install, upgrade or downgrade). "force-remove" tells it to forcibly remove any packages that were updated or downgraded.

The undo/redo commands act on the specified transaction, undo'ing or repeating the work of that transaction. While the rollback command will undo all transactions up to the point of the specified transaction. For example, if you have 3 transactions, where package A; B and C where installed respectively. Then "undo 1" will try to remove package A, "redo 1" will try to install package A (if it is not still installed), and "rollback 1" will try to remove packages B and C. Note that after a "rollback 1" you will have a fourth transaction, although the ending rpmdb version (see: yum version) should be the same in transactions 1 and 4.

Para ver seu histórico do YUM:

$ sudo yum history | head
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   120 | install httpd            | 2014-08-26 09:19 | Install        |    5   
   119 | install pydf             | 2014-08-22 17:11 | Install        |    1   
   118 | install xsel             | 2014-08-22 13:29 | Install        |    1   
   117 | install pastebinit       | 2014-08-22 13:26 | Install        |    2   
   116 | install xorg-x11-apps-0: | 2014-08-21 11:04 | Install        |    2   
   115 | remove adobe-release-x86 | 2014-08-21 02:18 | Erase          |    1   
   114 | update                   | 2014-08-21 02:15 | E, I, O, U     |   67  <

Para desfazer uma transação específica:

$ sudo yum history undo 120
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Undoing transaction 120, from Tue Aug 26 09:19:17 2014
    Dep-Install apr-1.5.1-1.fc20.x86_64                 @updates
    Dep-Install apr-util-1.5.3-1.fc20.x86_64            @updates
    Dep-Install fedora-logos-httpd-21.0.1-1.fc20.noarch @fedora
    Install     httpd-2.4.10-1.fc20.x86_64              @updates
    Dep-Install httpd-tools-2.4.10-1.fc20.x86_64        @updates
Resolving Dependencies
--> Running transaction check
---> Package apr.x86_64 0:1.5.1-1.fc20 will be erased
---> Package apr-util.x86_64 0:1.5.3-1.fc20 will be erased
---> Package fedora-logos-httpd.noarch 0:21.0.1-1.fc20 will be erased
---> Package httpd.x86_64 0:2.4.10-1.fc20 will be erased
---> Package httpd-tools.x86_64 0:2.4.10-1.fc20 will be erased
--> Finished Dependency Resolution
...
    
por 27.08.2014 / 18:19