#!/bin/bash VERSION=$(uname -r) function compile_for_5x { cd /usr/src/promethean/kernel sed -i 's/SUBDIRS/M/g' /usr/src/promethean/kernel/Makefile make -C /lib/modules/${VERSION}/build M=$PWD clean cp /usr/src/linux-headers-${VERSION}/Module.symvers /usr/src/promethean/kernel make -C /lib/modules/${VERSION}/build M=$PWD ./b cd $OLDPWD } ACTION="$1" case $ACTION in preInstall) apt-get update #Get the linux-headers of current kernel apt-get install -y linux-headers-$VERSION WRKDIR=$(mktemp -d) chmod 777 $WRKDIR cd $WRKDIR apt-get download activinspire if [ $? -ne 0 ] then exit 1 fi #Rebuild the package without libcurl3 depend mkdir wrk dpkg-deb -R activinspire*.deb wrk sed -i 's/libcurl3,//g' wrk/DEBIAN/control dpkg-deb -b wrk activinspire-lliurex.deb dpkg -i $PWD/activinspire-lliurex.deb apt-get install -y -f apt-get install -y activinspire-32bitdependsfor64bit-lliurex if [ $? -ne 0 ] then exit 1 fi ;; postInstall) dpkg --compare-versions 5.0 lt $VERSION && compile_for_5x ;; remove) errpkg='' for pkg in promethean-fixboot activinspire activrelay activtools activdriver activaid do apt-get remove -y $pkg TEST=$( dpkg-query -s $pkg 2> /dev/null| grep Status | cut -d " " -f 4 ) if [ "$TEST" == 'installed' ];then errpkg="$errpkg $pkg" fi done if [ ${#errpkg} -gt 0 ] then exit 1 fi ;; esac exit 0