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 >