mirror of https://github.com/dynup/kpatch
Merge pull request #425 from jpoimboe/fedora-src-rpm-koji-2
kpatch-build: download fedora src rpms from koji
This commit is contained in:
commit
43ca05e5b1
|
@ -42,7 +42,7 @@ sudo yum install gcc kernel-devel elfutils elfutils-devel
|
|||
Install the dependencies for the "kpatch-build" command:
|
||||
|
||||
```bash
|
||||
sudo yum install rpmdevtools pesign yum-utils openssl
|
||||
sudo yum install rpmdevtools pesign yum-utils openssl wget
|
||||
sudo yum-builddep kernel
|
||||
sudo debuginfo-install kernel
|
||||
|
||||
|
|
|
@ -238,6 +238,12 @@ done
|
|||
TEMPDIR="$(mktemp -d /tmp/kpatch-build-XXXXXX)" || die "mktemp failed"
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
KVER=${ARCHVERSION%%-*}
|
||||
if [[ $ARCHVERSION =~ - ]]; then
|
||||
KREL=${ARCHVERSION##*-}
|
||||
KREL=${KREL%.*}
|
||||
fi
|
||||
|
||||
if [[ -n $USERSRCDIR ]]; then
|
||||
# save .config and vmlinux since they'll get removed with mrproper so
|
||||
# we can restore them later and be able to run kpatch-build multiple
|
||||
|
@ -298,12 +304,6 @@ if [[ -n "$USERSRCDIR" ]]; then
|
|||
|
||||
cp -f "$CONFIGFILE" "$OBJDIR/.config"
|
||||
|
||||
echo "Detecting kernel version"
|
||||
cd "$SRCDIR"
|
||||
make mrproper >> "$LOGFILE" 2>&1 || die "make mrproper failed"
|
||||
make O="$OBJDIR" prepare >> "$LOGFILE" 2>&1 || die "make prepare failed"
|
||||
ARCHVERSION=$(make O="$OBJDIR" kernelrelease) || die "make kernelrelease failed"
|
||||
|
||||
elif [[ -e "$SRCDIR" ]] && [[ -e "$VERSIONFILE" ]] && [[ $(cat "$VERSIONFILE") = $ARCHVERSION ]]; then
|
||||
echo "Using cache at $SRCDIR"
|
||||
|
||||
|
@ -313,13 +313,16 @@ else
|
|||
echo "Fedora/Red Hat distribution detected"
|
||||
rpm -q --quiet rpmdevtools || die "rpmdevtools not installed"
|
||||
|
||||
echo "Downloading kernel source for $ARCHVERSION"
|
||||
if [[ -z "$SRCRPM" ]]; then
|
||||
rpm -q --quiet yum-utils || die "yum-utils not installed"
|
||||
|
||||
echo "Downloading kernel source for $ARCHVERSION"
|
||||
yumdownloader --source --destdir "$TEMPDIR" "kernel-$ARCHVERSION" >> "$LOGFILE" 2>&1 || die
|
||||
SRCRPM="$TEMPDIR/kernel-${ARCHVERSION%*.*}.src.rpm"
|
||||
if [[ $DISTRO = fedora ]]; then
|
||||
wget -P $TEMPDIR http://kojipkgs.fedoraproject.org/packages/kernel/$KVER/$KREL/src/kernel-$KVER-$KREL.src.rpm >> "$LOGFILE" 2>&1 || die
|
||||
else
|
||||
rpm -q --quiet yum-utils || die "yum-utils not installed"
|
||||
yumdownloader --source --destdir "$TEMPDIR" "kernel-$ARCHVERSION" >> "$LOGFILE" 2>&1 || die
|
||||
fi
|
||||
fi
|
||||
SRCRPM="$TEMPDIR/kernel-$KVER-$KREL.src.rpm"
|
||||
|
||||
echo "Unpacking kernel source"
|
||||
rpmdev-setuptree >> "$LOGFILE" 2>&1 || die
|
||||
|
@ -362,7 +365,7 @@ else
|
|||
# The linux-source packages are formatted like the following for:
|
||||
# ubuntu: linux-source-3.13.0_3.13.0-24.46_all.deb
|
||||
# debian: linux-source-3.14_3.14.7-1_all.deb
|
||||
pkgver="${ARCHVERSION%%-*}_$(dpkg-query -W -f='${Version}' linux-image-$(uname -r))"
|
||||
pkgver="$KVER_$(dpkg-query -W -f='${Version}' linux-image-$ARCHVERSION)"
|
||||
pkgname="linux-source-${pkgver}_all"
|
||||
|
||||
cd $TEMPDIR
|
||||
|
@ -373,9 +376,9 @@ else
|
|||
echo "Unpacking kernel source"
|
||||
dpkg -x ${pkgname}.deb $TEMPDIR >> "$LOGFILE" || die "dpkg: Could not extract ${pkgname}.deb"
|
||||
# extract and move to SRCDIR
|
||||
tar $taroptions usr/src/linux-source-${ARCHVERSION%%-*}.tar.${extension} >> "$LOGFILE" || die "tar: Failed to extract kernel source package"
|
||||
tar $taroptions usr/src/linux-source-$KVER.tar.${extension} >> "$LOGFILE" || die "tar: Failed to extract kernel source package"
|
||||
clean_cache
|
||||
mv linux-source-${ARCHVERSION%%-*} "$SRCDIR" || die
|
||||
mv linux-source-$KVER "$SRCDIR" || die
|
||||
cp "/boot/config-${ARCHVERSION}" "$OBJDIR/.config" || die
|
||||
if [[ "$ARCHVERSION" == *-* ]]; then
|
||||
echo "-${ARCHVERSION#*-}" > "$SRCDIR/localversion" || die
|
||||
|
|
Loading…
Reference in New Issue