SCIENTIFIC-LINUX-DEVEL Archives

October 2012

SCIENTIFIC-LINUX-DEVEL@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Teck Choon Giam <[log in to unmask]>
Reply To:
Teck Choon Giam <[log in to unmask]>
Date:
Tue, 16 Oct 2012 05:09:20 +0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
On Sat, Oct 13, 2012 at 8:52 PM, Steven Haigh <[log in to unmask]> wrote:
> Hi all,
>
> I'm trying to make my kernel-xen package for EL6 also be buildable on EL5.
> One of the things that EL5 doesn't have is dracut - hence the --dracut
> option in new-kernel-pkg doesn't exist.
>
> I figured I could do some basic logic here in the %post and check the rhel
> version and run the appropriate command. The code:
>
> if [ -x /sbin/new-kernel-pkg ]
> then
> %if 0%{?rhel} == 5
>         /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install
> %{KRELEASE} || exit $?
> %endif
> %if 0%{?rhel} == 6
>         /sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod
> --install %{KRELEASE} || exit $?
> %endif
> fi

Why you need to have each condition for each release (rhel 5 and 6)?

If you are building your packages for only two releases (rhel 5 and
rhel6), maybe something like below?

if [ -x /sbin/new-kernel-pkg ] ; then
%if 0%{?rhel} > 5
        /sbin/new-kernel-pkg --package kernel --mkinitrd --dracut
--depmod --install %{KRELEASE} || exit $?
%else
        /sbin/new-kernel-pkg --package kernel --mkinitrd --depmod
--install %{KRELEASE} || exit $?
%endif
fi


Thanks.

Kindest regards,
Giam Teck Choon


>
> When I install the package however, I get:
> /var/tmp/rpm-tmp.89138: line 13: syntax error near unexpected token `fi'
> /var/tmp/rpm-tmp.89138: line 13: `fi'
> error: %post(kernel-xen-3.5.4-4.x86_64) scriptlet failed, exit status 2
>
> It just so happens that line 13 of %post is: %if 0%{?rhel} == 5
>
> Does anyone have any insight on this? My google-foo has been failing badly
> on this :(
>
> While I apologise that this isn't specifically related to SL, it is about
> creation of packages for SL6 and (eventually) SL5.
>
> --
> Steven Haigh
>
> Email: [log in to unmask]
> Web: http://www.crc.id.au
> Phone: (03) 9001 6090 - 0412 935 897
> Fax: (03) 8338 0299
>

ATOM RSS1 RSS2