Created
October 24, 2012 15:39
-
-
Save treydock/3946825 to your computer and use it in GitHub Desktop.
Find current kernel version in mock environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ARCH=$(uname -m) | |
[ "$ARCH" == "x86_64" ] && INV_ARCH="i686" || INV_ARCH="x86_64" | |
KERNEL=$(uname -r) | |
echo $KERNEL | grep -q $ARCH | |
[ $? -ne 0 ] && echo ${KERNEL//$INV_ARCH/$ARCH} || echo $KERNEL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
When building RPMs within a mock chroot,
uname
returns the kernel of running system not the chroot. This is problematic if a Makefile usesuname -r
to find the kernel source when the mock environment is i686 and build system is x86_64.Example Usage
rpm.spec