#!/bin/env  bash
echo install actual tomte version
dpkg --configure -a
apt-get update
apt-get install -y tuxedo-tomte
if [[ $? > 0 ]]
then
    echo "Installing tuxedo-tomte failed, exiting."
    exit
else
if [ -f /etc/tomte/tomte.cfg ]; then
    mv /etc/tomte/tomte.cfg /etc/tomte/tomte.cfg.old
fi
    for i in $(tomte modules); do tomte unblock $i; done
    tomte reconfigure all
fi
for i in $(dpkg -l | awk '/\-dkms/{ print $2 }'); do dpkg-reconfigure $i; done

if [ "$(dpkg -l | awk '/tuxedo-drivers/{ print $2 }')" ]; then
    dpkg-reconfigure tuxedo-drivers
fi
