#!/bin/bash

Xdialog --title "RESTRICTED FILE REMOVAL" \
        --yesno "The multimedia files are patent-encumbered in some countries,\nwhich is why they are not \
	installed on Absolute by default.\n\nIf someone has installed them without authorization \nor \
	without realizing that their installation and/or use\n may possibly be illegal in their country,\n \
	this utility will remove them.\n\nDo you wish to continue?\n\n" 0 0

if [ $? == 1 ]; then
	exit
fi
cd /var/log/packages
ffmpeg_file=`find . -name 'ffmpeg*' -exec basename {} \;`
libdvdcss_file=`find . -name 'libdvdcss*' -exec basename {} \;`
mplayer_codecs_file=`find . -name 'mplayer-codecs*' -exec basename {} \;`

Xdialog --left --title "FILES TO REMOVE" \
--yesno "The following files were found:\n\n \
$ffmpeg_file\n \
$libdvdcss_file\n \
$mplayer_codecs_file\n\n If you choose YES,\nthese files will be romoved from your system.\n\nDo you wish to continue?\n\n" 0 0

if [ $? == 1 ]; then
	exit
fi

okFlag=0
for f in "$lame_file" "$ffmpeg_file" "$libdvdcss_file" "$mplayer_codecs_file"; 
do
	if [ ! "$f" == "" ]; then
		removepkg $f >/dev/null 2>&1 || okFlag=1
	fi
done
if [ $okFlag -eq 0 ]; then
	msg="\nAll the listed packages have been removed.\n\nIf you do not want these files to ever be installed\n\
via the system utility again, delete the directory\n /usr/src/restricted\n\n"
else
	msg="\nNot all of the packages were removed.\n\nThey should be removeable via the PACKAGE TOOL utility\n\
as root, you can see in the menu:\nSTART > SYSTEM TOOLS > CONFIGURATION > PACKAGE TOOL\n\
look for lame, ffmpeg, libdvdcss and mplayer-codecs, \nand delete as necessary...\n\n"
fi
Xdialog --left --title "COMPLETE" --msgbox "$msg" 0 0
