Rpm-Uvh update traps

Source: Internet
Author: User

Rpm-Uvh update traps
Symptom

After upgrading with rpm-Uvh, the original soft link is deleted, and the rpm package is first uninstalled by rpm-e and then installed by rpm-ivh. The soft link is still in progress. This soft link is created when the rpm package is installed and will be deleted only when the rpm package is uninstalled.

Why does Uvh delete it during upgrade?

Solution Process

The deletion of soft links is written in the % preun segment of the sepc file, and the soft link is established in the % post segment of the spec file. So when I checked the update, the execution sequence of each segment in the spec file.

Upgrade execution sequence
1. Execute % pre In the spec file of the new package. 2. Install the dependent packages of the new package. 3. Execute the % post segment in the spec file of the new package. 4. Run the % preun section in the spec file of the old package. 5. Delete unnecessary old files in the new package. 6. Run the % postun section in the spec file of the old package.

The answer is obvious. During the upgrade process, a new package is installed and the old package is uninstalled. Therefore, the soft link is deleted.

Solution

When different operations are performed, different parameters are passed to the segment. The complete parameter transfer and interpretation are as follows.

When the first parameter passed in the % pre and % post segments is 1, an rpm package is installed. When the first parameter is 2, an existing package is upgraded. When the first parameter passed in the % preun and % postun segments is 0, a package is deleted. When the first parameter is 1, it indicates updating a package.

Therefore, before deleting a link, determine whether the passed parameter is 0 or 1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.