#!/bin/sh

post_install() {
   local simpleversion=`private__calculate_version`
   local fullversion=`private__calculate_full_version`

   private__link_at_system_kernel_boot $simpleversion $fullversion
   private__check_firmware
   private__check_dependant_modules $goboShared/Compile/Recompile/Linux
}

private__check_firmware () {
   # check for different versions of firmware
   [ ! -z "`egrep 'CONFIG_IPW2200=[my]' .config`" ] && private__check_firmware_version IPW2200 3.0
   [ ! -z "`egrep 'CONFIG_IPW2100=[my]' .config`" ] && private__check_firmware_version IPW2100 1.3
}

private__check_firmware_version () {
   driver=$1
   req_version=$2
   version_found=false
   for version in ${goboPrograms}/${driver}-Firmware/*
   do
      if [ `GuessLatest ${req_version} $version` = `echo $version | sed 's/.*\/\(.*\)$/\1/g'` ]
      then
         version_found=true
         break
      fi
   done 2> /dev/null
   if [ "$version_found" = "false" ]
   then
      Ask "You need to install firmware for the ${driver} driver to work. Do you want to install it?" && InstallPackage ${driver}-Firmware ${req_version}
   fi
}
