#!/bin/bash


ACTION="$1"

shift
PACKAGE_LIST=$@

case $ACTION in
	getStatus)
			TEST=$( dpkg-query -s $ix 2> /dev/null| grep Status | cut -d " " -f 4 )
			if [ "$TEST" == "installed" ];then
				echo 0
			else
				echo 1
			fi	
	;;
	
	installPackage)
		f=$(mktemp --suffix .deb)
		/usr/share/zero-lliurex-teams/teams-downloader.py $f
		dpkg -i $f
		rm $f
		;;
		


	remove)
		for ix in $PACKAGE_LIST	
		do
			apt-get -y remove $ix
			TEST=$( dpkg-query -s $ix 2> /dev/null| grep Status | cut -d " " -f 4 )
			if [ "$TEST" == "installed" ];then
				exit 1
			fi	
		done	
				
	;;	
esac
exit 0
