#!/bin/bash

system=$(cat /sys/class/dmi/id/product_name | sed 's/ *$//g')
#echo "$system"
result=$(grep -ir "deb http://ppa.launchpad.net/canonical-hwe-team/sputnik" "/etc/apt/")
#echo "$result"

if [[ "$system" == *L322X* ]]; then
     echo "Found model L322X"
     if [[ "$result" == *sputnik-kernel* ]]; then
          echo "Sputnik Kernel PPA already added. Nothing to do."
     else
          echo "Adding PPA for Sputnik Kernel Support..."
          apt-key add /var/tmp/sputnik.gpg
          echo "deb http://ppa.launchpad.net/canonical-hwe-team/sputnik-kernel/ubuntu precise main" \
              >> /etc/apt/sources.list.d/canonical-hwe-sputnik-kernel-precise.list
          echo "deb-src http://ppa.launchpad.net/canonical-hwe-team/sputnik-kernel/ubuntu precise main" \
              >> /etc/apt/sources.list.d/canonical-hwe-sputnik-kernel-precise.list
     fi
else
     echo "This is not a model L322X...continuing"
fi

rm /var/tmp/sputnik.gpg
#DEBHELPER#
