Commit 499ac136 authored by Seblu's avatar Seblu
Browse files

Improve linux-seblu PKGBUILD

- use https url, inside a variable
- forbit invalid pkgname
- doesn't use .sign as they are not supported by makepkg
- upstream patches (rc, stable) are no more prefixed by linux- before downloading
- upstream patches are symlinked instead of copied
parent aede727a
Loading
Loading
Loading
Loading
+43 −21
Original line number Diff line number Diff line
@@ -3,7 +3,11 @@

shopt -s nullglob

kernelver=3.10
# WARNING:
# Always use 3 dot versionning here! (e.g: 3.11.0, not 3.11)
# Althought tarball release are not nammed with the third number, the kernel
# built version contains it. Thus, modules and identifiers are with the last 0.
kernelver=3.11-rc5
kernelsuf=-seblu
pkgname=linux
pkgver=1
@@ -15,26 +19,45 @@ options=('!strip')
makedepends=('kmod' 'bc' 'xmlto' 'docbook-xsl')
source=("config.$CARCH")
md5sums=('SKIP')
# here we have a linus rc kernel
if [[ $kernelver =~ -rc ]]; then

# major kernel version (first number)
kernelmaj=${kernelver%%.*}
# base url for kernel related tarballs (full, patch, etc)
kernelurl="https://www.kernel.org/pub/linux/kernel/v$kernelmaj.x"

# here we have a Linus kernel
if [[ $kernelver =~ $kernelmaj\.[[:digit:]]+\.0 ]]; then
  # kernel base is the version of the full kernel tarball to download
  kernelbase=${kernelver%.0}
# here we have a Linus rc kernel
elif [[ $kernelver =~ -rc ]]; then
  kernelbase=${kernelver%-rc*}
  kernelbase=${kernelbase%%.*}.$((${kernelbase##*.} - 1))
  source+=("linux-$kernelver.patch.xz::http://www.kernel.org/pub/linux/kernel/v3.0/testing/patch-$kernelver.xz")
  md5sums+=('SKIP')
# here we have stable kernel schema
elif [[ $kernelver =~ [[:digit:]]\.[[:digit:]]\.[[:digit:]] ]]; then
  kernelbase=$kernelmaj.$((${kernelbase#*.} - 1))
  patchurl="testing/patch-$kernelver.xz"
# here we have stable kernel schema (probably Greg)
elif [[ $kernelver =~ $kernelmaj\.[[:digit:]]+\.[[:digit:]]+ ]]; then
  # kernel base is the version of the full kernel tarball to download
  kernelbase=${kernelver%.*}
  (( ${kernelver##*.} != 0 )) &&
    source+=("linux-$kernelver.patch.xz::http://www.kernel.org/pub/linux/kernel/v3.0/patch-$kernelver.xz")
    md5sums+=('SKIP')
# here we have a linus kernel
  patchurl="patch-$kernelver.xz"
else
  kernelbase=$kernelver
  kernelver=$kernelver.0
  # we are in error, probably the last version number is not here
  error "Invalid kernel number: $kernelver, read warning before \$kernelver!"
  exit 2
fi
source+=("http://www.kernel.org/pub/linux/kernel/v3.0/linux-$kernelbase.tar.xz")

# adding base kernel to sources
# we doesn't use .sign as kernel.org provide only .sign for raw tarball (no xz)
# makepkg doesn't handle this correctly
source+=("$kernelurl/linux-$kernelbase.tar.xz")
md5sums+=('SKIP')
# we can now compute real package name. Useful to avoid overwrite

# adding patch to sources
if [[ -n $patchurl ]]; then
  source+=("$kernelurl/$patchurl")
  md5sums+=('SKIP')
fi

# we can now guess real package name. Useful to avoid overwrite
pkgname=$pkgname$kernelsuf-$kernelver

# small hack to avoid makepkg to check checksum
@@ -42,13 +65,12 @@ pkgname=$pkgname$kernelsuf-$kernelver

prepare() {
  # priorize upstream patch
  if [[ -e linux-$kernelver.patch ]]; then
    mv -f linux-$kernelver.patch 00-linux-$kernelver.patch
  if [[ -e patch-$kernelver ]]; then
    ln -sf patch-$kernelver 00-patch-$kernelver.patch
  fi

  # apply patches
  cd linux-$kernelbase
  # priorize upstream update patch
  # merging patches
  for _f in "$srcdir"/*.patch; do
    [[ -r "$_f" ]] || continue
    msg2 "  Applying patch: ${_f##*/}"
@@ -98,7 +120,7 @@ package() {
  depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio')
  install='install'

  sed -ri "s/pkgname=.*/pkgname='$pkgname'/" "$startdir/install"
  sed -ri "s/pkgname=.*/pkgname='$pkgname'/" "$startdir/$install"

  # installing modules
  # disable DEPMOD because it fail due to poor hack in scripts/depmod.sh