Setting and using environment variables when building RPMs
Posted on 2004-10-28
I'm trying to build an RPM from the GPL'd Emulex driver for the LP9002L HBA. The initial build works fine, but I'm trying to change the SPEC file so that the RPM is built for the currently running kernel. This way we don't have to update the SPEC file every time we want to build for a new kernel, just build on a machine running the new kernel.
I tried using the following lines in my spec file:
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KERNEL_VERSION/kernel/drivers/scsi
install -s -m 755 lpfcdd.o $RPM_BUILD_ROOT/lib/modules/$KERNEL_VERSION/kernel/drivers/scsi/lpfcdd.o
I'm then doing
KERNEL_VERSION=`uname -r` rpmbuild -bb specfile
Looking at the output, it appears that the variable is being used in the %install section, but not in the %files section. I say this because I get the following output:
mkdir -p /var/tmp/lpfcdriver-buildroot/lib/modules/2.4.21-20.ELsmp/kernel/drivers/scsi
install -s -m 755 lpfcdd.o /var/tmp/lpfcdriver-buildroot/lib/modules/2.4.21-20.ELsmp/kernel/drivers/scsi/lpfcdd.o
error: File not found: /var/tmp/lpfcdriver-buildroot/lib/modules/$KERNEL_VERSION/kernel/drivers/scsi/lpfcdd.o
RPM build errors:
File not found: /var/tmp/lpfcdriver-buildroot/lib/modules/$KERNEL_VERSION/kernel/drivers/scsi/lpfcdd.o
Can anyone advise how I could go about fixing this ?