| 41 | == Swapping alternate packages == |
| 42 | |
| 43 | There are packages that provide identical functionality using a different set of programs. Often such alternate packages cannot be installed together because they provide identical file names or need exclusive access to some other resources. If you try to install one package without first removing another, RPM will complain. |
| 44 | |
| 45 | So, in order to swap such packages — usually, to switch between various implementations of the given functionality — you first need to remove one package and then install another one. However, there may be other packages that depend on the provided functionality and if any of these dependent packages is already installed when you try to remove one of the alternatives, RPM will not let you do that too. |
| 46 | |
| 47 | Let's assume a real world example. You want to switch from the `ash-sh` package (that provides the original NetBSD version of the POSIX shell) to the `dash-sh` package (that provides the Debian flavor of NetBSD shell). Both of these packages install a file called `/@unixroot/usr/bin/sh.exe` and you will surely have many packages that depend on that file (basically, any package that contains shell scripts) already installed, so two separate install-remove steps won't work. You need a special command to perform such a swap. |
| 48 | |
| 49 | The current version of `yum` lacks a one-line command for this operation but there is an easy way to do using the interactive Yum Shell. Here is how to switch from `ash-sh` to `dash-sh` using this approach (commands you that type in are the ones after the `>` prompt): |
| 50 | |
| 51 | {{{ |
| 52 | D:>yum shell |
| 53 | Setting up Yum Shell |
| 54 | > remove ash-sh |
| 55 | Setting up Remove Process |
| 56 | > install dash-sh |
| 57 | Setting up Install Process |
| 58 | > run |
| 59 | > exit |
| 60 | }}} |
| 61 | |
| 62 | You may swap any conflicting packages using this algorithm provided that the resulting package configuration does not leave any unresolved package dependencies. |
| 63 | |