Whamcloud - gitweb
LU-8058 lnet: Remove old commented out code
[fs/lustre-release.git] / contrib / lbuild / find_linux_rpms
1 #!/bin/bash
2
3 # this is an alternative FD for stdout, to be used especially when we are
4 # taking stdout from a function as it's return value.  i.e. foo=$(bar)
5 # this is a workaround until a version of bash where we can put xtrace
6 # on a specific FD
7 #exec 3>&1; STDOUT=3
8 STDOUT=2
9
10 # Assume that lbuild's support files can be found in the same
11 # canonicalized path as this very script.
12 THIS_SCRIPT=$(readlink -f ${0})
13 LBUILD_DIR=${LBUILD_DIR:-$(dirname ${THIS_SCRIPT})}
14
15 . $LBUILD_DIR/funcs.sh
16
17 TOPDIR=$PWD
18
19 # same as lbuild's --kernelrpm switch
20 KERNELRPMSDIR="$1"
21
22 DISTRO=$(autodetect_distro)
23 # remove separator
24 DISTRO=${DISTRO/-/}
25 DISTROMAJ=${DISTRO%%.*}
26
27 if [ -f $LBUILD_DIR/lbuild-$DISTRO ]; then
28     . $LBUILD_DIR/lbuild-$DISTRO
29 else
30     . $LBUILD_DIR/lbuild-$DISTROMAJ
31 fi
32
33 TARGET_ARCH="$(uname -m)"
34 TARGET_ARCHS="$(uname -m)"
35 TARGET_ARCHS_ALL="$(uname -m)"
36
37 # need lnxmaj from the target file
38 TARGET=$(autodetect_target "$DISTRO")
39 TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target"
40 . "$TARGET_FILE"
41
42 if ! kernelrpm=$(find_linux_rpms "-$DEVEL_KERNEL_TYPE" "$KERNELRPMSDIR"); then
43     fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in ${KERNELRPMSDIR}"
44 fi
45
46 echo "$kernelrpm"