Re: Create two different rpms in the same spec file

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

 



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@xxxxxx>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux