From 57df6e7bdce7d37ae9674d480f2edfce0cf94ea2 Mon Sep 17 00:00:00 2001
From: Lior Spach <ls12@inf.ufpr.br>
Date: Fri, 16 Aug 2013 14:04:11 -0300
Subject: [PATCH] le-pregao-712010: Refs #1280, Check whether linux-headers is
 installed

Signed-off-by: Lior Spach <ls12@inf.ufpr.br>
---
 le-pregao-712010/pacote/DEBIAN/postinst | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/le-pregao-712010/pacote/DEBIAN/postinst b/le-pregao-712010/pacote/DEBIAN/postinst
index 2386cd08f..446efc4d2 100755
--- a/le-pregao-712010/pacote/DEBIAN/postinst
+++ b/le-pregao-712010/pacote/DEBIAN/postinst
@@ -25,13 +25,17 @@ PACKAGE_VERSION="2.3.0.0-Alpha-v2"
 KERNEL_VERSION="$(uname -r)"
 ALL_KERNEL_VERSION="$(dpkg --get-selections | egrep '^linux-image.*generic-pae.*install$' | awk '{print $1}' | cut --bytes=13-)"
 
-# Put conflicting modules at /etc/modprobe.d/blacklist.conf 
-echo "# replaced by rt3562sta" >> /etc/modprobe.d/blacklist.conf
-echo "blacklist rt2800pci" >> /etc/modprobe.d/blacklist.conf
 
-# Put conflicting modules at /etc/modprobe.d/blacklist.conf 
-echo "# enable wireless for pregao 71/2010" >> /etc/modules
-echo "rt3562sta" >> /etc/modules
+#Verify if linux-headers already installed
+TEST_HEADERS_INSTALLED="$(dpkg --get-selections | grep "linux-headers-${KERNEL_VERSION}.*install$")"
+echo -n "Verifying if linux-headers are installed... "
+if [ "$TEST_HEADERS_INSTALLED" != "" ]; then
+    echo "Ok."
+else
+    echo "WARNING: LINUX-HEADERS MISSING"
+    echo "Install manually by typing the command"
+    echo "apt-get install linux-headers-$KERNEL_VERSION"
+fi
 
 # Function to set selections
 setselections() {
@@ -53,11 +57,12 @@ rm -f ${sels}
 setselections ${auxfile} & disown
 
 echo "Building and Installing module for each installed kernel using dkms..."
-dkms add -m $PACKAGE_NAME -v $PACKAGE_VERSION
+dkms add -m $PACKAGE_NAME -v $PACKAGE_VERSION || true
 for EACH_KERNEL in $ALL_KERNEL_VERSION
 do
-    dkms build -m $PACKAGE_NAME -v $PACKAGE_VERSION -k $EACH_KERNEL
-    dkms install -m $PACKAGE_NAME -v $PACKAGE_VERSION -k $EACH_KERNEL
+    echo "FOR KERNEl: $EACH_KERNEL"
+    dkms build -m $PACKAGE_NAME -v $PACKAGE_VERSION -k $EACH_KERNEL || true
+    dkms install -m $PACKAGE_NAME -v $PACKAGE_VERSION -k $EACH_KERNEL || true
 done
 
 echo "Loading module rt3562sta"
-- 
GitLab