Date: Sunday, March 8, 2015 @ 11:05:23
  Author: foutrelis
Revision: 128895

Drop use of uname to allow building in a chroot

Modified:
  tp_smapi/trunk/PKGBUILD

----------+
 PKGBUILD |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2015-03-08 09:57:25 UTC (rev 128894)
+++ PKGBUILD    2015-03-08 10:05:23 UTC (rev 128895)
@@ -10,6 +10,7 @@
 
 pkgname=tp_smapi
 pkgver=0.41
+_extramodules=extramodules-3.19-ARCH
 pkgrel=63
 pkgdesc="Modules for ThinkPad's SMAPI functionality"
 arch=('i686' 'x86_64')
@@ -24,27 +25,23 @@
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
 
-  _kernver=${_kernver:-$(uname -r)}
-  _extramodules=$(readlink -f "/usr/lib/modules/${_kernver}/extramodules" || 
true)
-  _kernver=$(< "${_extramodules}/version")
+  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
 
   sed -ri -e "s/^(KVER\s*:=).*$/\1 ${_kernver}/" \
-         -e "s#^(KBASE\s*:=).*\$#\1 ${_extramodules%/*}/${_kernver}#" Makefile
+    -e "s|^(KBASE\s*:=).*\$|\1 /usr/lib/modules/${_kernver}|" Makefile
 
   make HDAPS=1
 }
 
 package() {
-  _kernver=${_kernver:-$(uname -r)}
-  _extramodules=$(readlink -f "/usr/lib/modules/${_kernver}/extramodules" || 
true)
-  _kernver=$(< "${_extramodules}/version")
+  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
 
-  make -C "${_extramodules%/*}/${_kernver}/build" \
-    INSTALL_MOD_PATH="${pkgdir}/${_extramodules%%/lib/*}" \
+  make -C "/usr/lib/modules/${_kernver}/build" \
+    INSTALL_MOD_PATH="${pkgdir}/usr" \
     M="${srcdir}/${pkgname}-${pkgver}" modules_install
 
-  cd "${pkgdir}/${_extramodules%/*}"
-  mv "${_kernver}/extra" "${_extramodules##*/}"
+  cd "${pkgdir}/usr/lib/modules"
+  mv "${_kernver}/extra" "${_extramodules}"
   rmdir "${_kernver}"
 
   # compress kernel modules
@@ -55,5 +52,6 @@
   install -Dm644 "${srcdir}/${pkgname}.conf" 
"${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"
 
   # update kernel version in install file
-  sed -ri "s#^(extramodules=).*\$#\1${_extramodules}#" 
"${startdir}/${pkgname}.install"
+  sed -ri "s|^(extramodules=).*\$|\1/usr/lib/modules/${_extramodules}|" \
+    "${startdir}/${pkgname}.install"
 }

Reply via email to