Maximum RPM (RPM):Using RPM to Install Packages:EarthWeb Inc.-
-->
Previous | Table of Contents | Next
Page 27
No! RPM won't cook your goose. (You'll have to do that yourself!) It will save any
changes you've made, to a config file called
file.rpmsave. Let's give it a try.
As system administrator, you want to make sure your new users have a rich environment
the first time they log in. So you've come up with a really nifty
.bashrc file that will be executed whenever they log in. Knowing that everyone will enjoy your wonderful
.bashrc file, you place it in /etc/skel. That way, every time a new account is created, your
.bashrc will be copied into the new user's login directory.
Not realizing that the .bashrc file you modified in
/etc/skel is listed as a config file in a package called (strangely enough)
etcskel, you decide to experiment with RPM using the
etcskel package. First you try to install it:
# rpm -iv etcskel-1.0-100.i386.rpm
etcskel /etc/skel/.bashrc conflicts with file from etcskel-1.0-3
error: etcskel-1.0-100.i386.rpm cannot be installed
#
Hmmm. That didn't work. Wait a minute! You can add
--replacefiles to the command and it should install just fine:
# rpm -iv --replacefiles etcskel-1.0-100.i386.rpm
Installing etcskel-1.0-100.i386.rpm
warning: /etc/skel/.bashrc saved as /etc/skel/.bashrc.rpmsave
#
Wait a minute. That's my customized .bashrc! Was it really saved? Let's see:
# ls -al /etc/skel/
total 8 -rwxr-xr-x 1 root root 186 Oct 12 1994 .Xclients
-rw-r--r-- 1 root root 1126 Aug 23 1995 .Xdefaults
-rw-r--r-- 1 root root 24 Jul 13 1994 .bash logout
-rw-r--r-- 1 root root 220 Aug 23 1995 .bash profile
-rw-r--r-- 1 root root 169 Jun 17 20:02 .bashrc
-rw-r--r-- 1 root root 159 Jun 17 20:46 .bashrc.rpmsave
drwxr-xr-x 2 root root 1024 May 13 13:18 .xfm
lrwxrwxrwx 1 root root 9 Jun 17 20:46 .xsession -> .Xclients
# cat /etc/skel/.bashrc.rpmsave
# .bashrc
# User specific aliases and functions
# Modified by the sysadmin
uptime
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
#
Whew! You heave a sigh of relief and study the new
.bashrc to see if the changes need to be integrated into your customized version.
Page 28
2.4.4.2. --replacefiles Can Mean Trouble Down the Road
Although --replacefiles can make today's difficult install easier, it can mean big
headaches in the future. When the time comes for erasing the packages involved in a file conflict,
bad things can happen. What bad things? Well, files can be deleted. Here's how, in three easy steps:
Two packages are installed. When the second package is installed, there is a
conflict with a file installed by the first package. Therefore, the
--replacefiles option is used to force RPM to replace the conflicting file with the one from the second package.
At some point in the future, the second package is erased.
The conflicting file is gone!
Let's look at an example. First, we install a new package. Next, we take a look at a file it
installed, noting the size and creation date:
# rpm -iv cdp-0.33-2.i386.rpm
Installing cdp-0.33-2.i386.rpm
# ls -al /usr/bin/cdp
-rwxr-xr-x 1 root root 34460 Feb 25 14:27 /usr/bin/cdp
#
Next, we try to install a newer release of the same package. It fails:
# rpm -iv cdp-0.33-3.i386.rpm
Installing cdp-0.33-3.i386.rpm
/usr/bin/cdp conflicts with file from cdp-0.33-2
error: cdp-0.33-3.i386.rpm cannot be installed
#
So we use --replacefiles to convince the newer package to install. We note that the
newer package installed a file on top of the file originally installed:
# rpm -iv --replacefiles cdp-0.33-3.i386.rpm
Installing cdp-0.33-3.i386.rpm
# ls -al /usr/bin/cdp
-rwxr-xr-x 1 root root 34444 Apr 24 22:37 /usr/bin/cdp
#
The original cdp file, 34,460 bytes long and dated February 25, has been replaced with a
file with the same name but 34,444 bytes long and from April 24. The original file is long gone.
Next, we erased the package we just installed. Finally, we tried to find the file:
# rpm -e cdp-0.33-3
# ls -al /usr/bin/cdp
ls: /usr/bin/cdp: No such file or directory
#
NOTE
For more information on erasing packages with rpm
-e, see Chapter 3.
Wyszukiwarka
Podobne podstrony:
r05 0027r02 0027I KZP 0027r01 0029100 0029r02 0029więcej podobnych podstron