[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Fwd: Building an RPM from a compiled application]



In regard to: Re: [Fwd: Building an RPM from a compiled application], Bill...:

>%post
>cd $RPM_INSTALL_PREFIX/repository/etc
>perl ./setperm
>
>and everything works fine.
>
>Now, is that right?

You might want to check for errors.  :-)  i.e.

	if test -d $RPM_INSTALL_PREFIX/repository/etc || \
		test -h $RPM_INSTALL_PREFIX/repository/etc ; then
			cd $RPM_INSTALL_PREFIX/repository/etc || exit 1
	else
		echo "foo!" >> /some/log/file
		exit 1
	fi

I seem to recall some version of RPM (probably in the 2.4 or 2.5.x series --
we're still using 2.5.6) didn't set RPM_INSTALL_PREFIX unless the package
was actually relocated, so you couldn't always depend on it being defined.
I've developed a habit of doing stuff like:

	if test X"$RPM_INSTALL_PREFIX" = X"" ; then
		RPM_INSTALL_PREFIX=%{PREFIX}
	fi

in my post too, to be certain we have at least some value for
RPM_INSTALL_PREFIX.  You probably don't need to do this (heck, *I*
probably don't need to do this), but I like to "make no assumptions".

> (the use of RPM_INSTALL_PREFIX?)  Or is there
>another way to do it.  I found RPM_INSTALL_PREFIX by running 'strings'
>on rpm and greping for prefix.  Not exactly ideal documentation :-)

RPM_INSTALL_PREFIX is documented, otherwise I would probably never know
about it.  :-)  Maximum RPM (yes, it's out of date and doesn't describe
many of the changes in 3.x and now 4.x) does describe it, I believe.

>2) Files not being removed during erase.  Um, actually, the files are
>being removed.  The directories are not, however, but I imagine that
>this is intentional.  It just happens that in my case, I expect to *not*
>install into /usr/bin (or whatever), so it would be OK to remove the
>directories.

Jeff already nailed this one, I think.  Use `%dir' in the %files section
to list what directories your package "owns".  They'll then automatically be
included in the package, and therefore removed when the package is removed.

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []