Merge pull request #705 from vincentbernat/fix/ubuntu-get-source

kpatch-build: retrieve source package instead of linux-source
This commit is contained in:
Jessica Yu 2017-05-18 20:23:21 -07:00 committed by GitHub
commit 5a04c3395a
2 changed files with 9 additions and 20 deletions

View File

@ -166,7 +166,7 @@ apt-get install make gcc libelf-dev
Install the dependencies for the "kpatch-build" command: Install the dependencies for the "kpatch-build" command:
```bash ```bash
apt-get install dpkg-dev apt-get install dpkg-dev devscripts
apt-get build-dep linux apt-get build-dep linux
# optional, but highly recommended # optional, but highly recommended

View File

@ -424,39 +424,28 @@ else
if [[ $DISTRO = ubuntu ]]; then if [[ $DISTRO = ubuntu ]]; then
# url may be changed for a different mirror # url may be changed for a different mirror
url="http://archive.ubuntu.com/ubuntu/pool/main/l/linux" url="http://archive.ubuntu.com/ubuntu/pool/main/l"
extension="bz2"
sublevel="SUBLEVEL = 0" sublevel="SUBLEVEL = 0"
taroptions="xvjf"
UBUNTU_KERNEL=1 UBUNTU_KERNEL=1
elif [[ $DISTRO = debian ]]; then elif [[ $DISTRO = debian ]]; then
# url may be changed for a different mirror # url may be changed for a different mirror
url="http://ftp.debian.org/debian/pool/main/l/linux" url="http://ftp.debian.org/debian/pool/main/l"
extension="xz"
sublevel="SUBLEVEL =" sublevel="SUBLEVEL ="
taroptions="xvf"
fi fi
# The linux-source packages are formatted like the following for: pkgname="$(dpkg-query -W -f='${Source}' linux-image-$ARCHVERSION)"
# ubuntu: linux-source-3.13.0_3.13.0-24.46_all.deb pkgver="$(dpkg-query -W -f='${Version}' linux-image-$ARCHVERSION)"
# debian: linux-source-3.14_3.14.7-1_all.deb dscname="${pkgname}_${pkgver}.dsc"
pkgver="${KVER}_$(dpkg-query -W -f='${Version}' linux-image-$ARCHVERSION)"
pkgname="linux-source-${pkgver}_all"
clean_cache clean_cache
cd $TEMPDIR cd $TEMPDIR
echo "Downloading the kernel source for $ARCHVERSION" echo "Downloading and unpacking the kernel source for $ARCHVERSION"
# Download source deb pkg # Download source deb pkg
(wget "$url/${pkgname}.deb" 2>&1) >> "$LOGFILE" || die "wget: Could not fetch $url/${pkgname}.deb" (dget -u "$url/${pkgname}/${dscname}" 2>&1) >> "$LOGFILE" || die "dget: Could not fetch/unpack $url/${pkgname}/${dscname}"
# Unpack mv ${pkgname}-$KVER "$SRCDIR" || die
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-$KVER.tar.${extension} >> "$LOGFILE" || die "tar: Failed to extract kernel source package"
mv linux-source-$KVER "$SRCDIR" || die
cp "/boot/config-${ARCHVERSION}" "$SRCDIR/.config" || die cp "/boot/config-${ARCHVERSION}" "$SRCDIR/.config" || die
if [[ "$ARCHVERSION" == *-* ]]; then if [[ "$ARCHVERSION" == *-* ]]; then
echo "-${ARCHVERSION#*-}" > "$SRCDIR/localversion" || die echo "-${ARCHVERSION#*-}" > "$SRCDIR/localversion" || die