#!/bin/bash

ACTION="$1"

shift
PACKAGE_LIST=$@

case $ACTION in

	remove)
		count=0
		for ix in $PACKAGE_LIST
		do
			if [[ "$ix" == "ganttproject" ]];then
				apt-get remove -y $ix

				TEST=$( dpkg-query -s $ix 2> /dev/null| grep Status | cut -d " " -f 4 )
				if [ "$TEST" == 'installed' ];then
					count+=1
				fi
			fi
		done

		if [ $count -gt 0 ];then
			exit 1
		fi
	;;

esac
exit 0	