#!/bin/bash
rmmod commandir lirc_cmdir lirc_dev
find /lib/modules -name "lirc_cmdir" -exec rm -rf {} \;
grep -q commandir-team /etc/apt/sources.list && echo "commandir apt source already found" || echo "deb http://ppa.launchpad.net/commandir-team/ubuntu jaunty main" >> /etc/apt/sources.list
apt-get update
apt-get install lirc
grep -q lirc_cmdir /etc/lirc/hardware.conf && echo "Please change your /etc/lirc/hardware.conf to not use lirc_cmdr! It should use remote_driver=\"commandir\" and/or transmitter_driver=\"commandir\" with no *_modules=lirc_cmdir" 
grep -q "MODULES=\"commandir" /etc/lirc/hardware.conf && echo "Please change your /etc/lirc/hardware.conf to not use *_modules=commandir! It should use remote_driver=\"commandir\" and/or transmitter_driver=\"commandir\" and *_modules=\"\""
/etc/init.d/lirc restart
echo "install-commandir.sh finished."

