This should be done in the preinst instead. Rationale: update-alternatives is part of dpkg, so doesn't require any Pre-Depends; and a dependency (such as the gcc-arm-linux-gnueabi dependency on gcc-4.5-arm-linux-gnueabi) does not prevent one package from being unpacked before the postinst of another package it depends on has been run. So if you do this in the postinst, you get:
- gcc-4.5-arm-linux-gnueabi unpacked (enforced by the Conflicts: from gcc-arm-linux-gnueabi)
- gcc-arm-linux-gnueabi unpacked; overwrites /usr/bin/arm-linux-gnueabi-gcc symlink
- gcc-4.5-arm-linux-gnueabi configured; u-a remove runs, removing the symlink
- gcc-arm-linux-gnueabi configured - but the gcc symlink is now missing
This should be done in the preinst instead. Rationale: update-alternatives is part of dpkg, so doesn't require any Pre-Depends; and a dependency (such as the gcc-arm- linux-gnueabi dependency on gcc-4.5- arm-linux- gnueabi) does not prevent one package from being unpacked before the postinst of another package it depends on has been run. So if you do this in the postinst, you get:
- gcc-4.5- arm-linux- gnueabi unpacked (enforced by the Conflicts: from gcc-arm- linux-gnueabi) linux-gnueabi unpacked; overwrites /usr/bin/ arm-linux- gnueabi- gcc symlink arm-linux- gnueabi configured; u-a remove runs, removing the symlink linux-gnueabi configured - but the gcc symlink is now missing
- gcc-arm-
- gcc-4.5-
- gcc-arm-
Otherwise, this looks ok.