Extracting Files from RPM Packages

来源:互联网 发布:中国自主软件 编辑:程序博客网 时间:2024/06/01 10:40

Extracting Files from RPM Packages

Software installed on your computer may become damaged. If this happens, it's good to know that you can extract files from the packages and copy them to the original location of the file.

Every RPM package consists of two parts: the metadata part that describes what is in the package and acpio archive that contains the actual files in the package. If a file has been damaged, you can start with therpm -qf query option to find out from what package the file originated. Next userpm2cpio | cpio -idmv to extract the files from the package to a temporary location. InExercise 4.5, you'll learn how to do this.

Exercise 4.5:Extracting Files from RPM Packages

In this exercise, you'll learn how to identify from which package a file originated. Next you'll extract the package to the/tmp directory, which allows you to copy the original file from the extracted RPM to the location where it's supposed to exist.

  1. Use rm -f /usr/sbin/modem-manager. Oops! You've just deleted a file from your system! (It normally doesn't do any harm to deletemodem-manager, because it's hardly ever used anymore.

  2. Use rpm -qf /usr/sbin/modem-manager. This command shows that the file comes from the ModemManager package.

  3. Copy the ModemManager package file from the repository you created inExercise 4.1 to the /tmp directory by using the cp /repo/ModemM[Tab] /tmp command.

  4. Change the directory to the /tmp command, and userpm2cpio |cpio -idmv to extract the package.

  5. The command you used in step 4 created a few subdirectories in/tmp. Activate the directory /tmp/usr/sbin, where you can find the modem-manager file. You can now copy it to its original location in/usr/sbin.

0 0
原创粉丝点击