[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Create two different rpms in the same spec file
- From: Jos Vos <jos xos nl>
- To: RPM Package Manager <rpm-list redhat com>
- Subject: Re: Create two different rpms in the same spec file
- Date: Sun, 20 Jan 2008 11:10:34 +0100
On Thu, Jan 17, 2008 at 02:45:55PM +0200, Doron Shoham wrote:
> I want to create two different rpms (one for redhat and the other for suse) in the same spec file.
> I have a file that is needed be in the same path (/etc/init) for both distros,
> The file's name is the same but its content is not the same for the two distros.
> How can I do it?
> Can %install can get "-n" as a parameter?
Why do you think of "-n"? Will the resulting package have different
names on RH and SUSE?
Anyway, it's simple when you use the %if / %endif constructions.
Note that it's a matter of taste if you really want this. In my
personal opinion, maintaining one spec file for multiple distros
often (with more complex packages) results in unnecessary complex
spec files.
Simplified example:
%if %(test -f /etc/redhat-release && echo 1 || echo 0)
%define target redhat
%endif
%if %(test -f ... && echo 1 || echo 0)
%define target suse
%endif
...
%install
%if %[target} == %{redhat}
cp %{SOURCE1} %{buildroot}/etc/rc.d/init.d/foo.init
%endif
%if %[target} == %{suse}
cp %{SOURCE2} %{buildroot}/etc/init.d/foo.init
%endif
...
%files
%if %[target} == %{redhat}
/etc/rc.d/init.d/foo.init
%endif
%if %[target} == %{suse}
/etc/init.d/foo.init
%endif
Note that this example is not complete and/or robust, of course.
--
-- Jos Vos <jos xos nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]