
#
# AutoPac_FR.sh
# Author:  Henry Hertz Hobbit
# Version: 1.1.4
# 2009-Nov-22 21:08 UTC
#
# Ce fichier de script qui fournit un moyen d'améliorer
# automatiquement la PAC par l'intermédiaire de filtres
# UnixUtils. Vous devez installer UnixUtils première though.
# Voir le UtilsSetup.txt fichier dans le dossier
# UnixUtilsInstallation_FR à le faire. L'alternative est
# d'utiliser la version complète de CygWin. Pour les
# utilisateurs de Windows qui est excessif. Ce script devra être
# réécrite pour CygWin.
#

CURDIR=`pwd`

cd ${SYSTEMDRIVE}
cd /

rm -f /etc/LastUsedSMPAC.txt.txt
# Faire un peu de l'équilibrage de charge primitive pour laquelle nous
# nous retirons d'accueil fichiers. La dernière clause d'autre, c'est
# pour quand rien n'est encore là.
if [ -f /etc/LastUsedSMPAC.txt ]
then
	rm -f /etc/LastUsedSMPAC.txt
	touch /etc/LastUsedHFPAC.txt
	DOWNLOADHOST=www.hostsfile.org
else
	if [ -f /etc/LastUsedHFPAC.txt ]
	then
		rm -f /etc/LastUsedHFPAC.txt
		touch /etc/LastUsedSMPAC.txt
		DOWNLOADHOST=www.securemecca.com
	else
		touch /etc/LastUsedSMPAC.txt
		DOWNLOADHOST=www.securemecca.com
	fi
fi

DOUPDATE=1

if [ ! -d etc ]
then
	mkdir etc
	DOUPDATE=0
fi

if [ ! -d etc ]
then
	echo
	echo LE MANQUE DE SCRIPT
	echo
	echo Appuyez sur Entrée pour quitter
	read UNUSEDRESPONSE
	exit 1
fi

# Si nous sommes à jour puis la sortie
wget -q  ${DOWNLOADHOST}/Downloads/pdate.txt
if [ -f pdate.txt ]
then
	if [ -f /etc/pdate.txt ]
	then
		if diff /etc/pdate.txt pdate.txt
		then
			rm -f pdate.txt
			echo "LE FILTRE PAC n'a pas changé"
			echo Appuyez sur Entrée pour quitter
			echo
			read UNUSEDRESPONSE
			exit 0
		fi
	fi
	cp -fp pdate.txt /etc/pdate.txt
fi
rm -f pdate.txt

cd etc
rm -fr  AutoPac_FR.msw
rm -f  AutoPac_FR.msw.*
if [ -f "${ProgramFiles}\7-Zip\7z.exe" ] && [ ! -f 7z.exe ]
then
	cp -f  "${ProgramFiles}\7-Zip\7z.exe" 7z.exe
	wget -q  ${DOWNLOADHOST}/Downloads/AutoPac_FR.msw.7z
	./7z.exe x AutoPac_FR.msw.7z
	rm -f 7z.exe
else
	wget -q ${DOWNLOADHOST}/Downloads/AutoPac_FR.msw.zip
	unzip AutoPac_FR.msw.zip
fi
rm -f AutoPac_FR.msw.*
if [ -d  AutoPac_FR.msw ]
then
	cd AutoPac_FR.msw
	if md5sum -c sums.md5
	then
		echo de contrôle sont bien ... l\'installation
		echo
		cd ..
		case ${DOUPDATE} in
		1)
			touch  SaveRules.txt
			rm -f oldproxy_fr.txt
			rm -f olddbgproxy_fr.txt
			if [ -f proxy_fr.txt ]
			then
				grep -U PERSONNELLE  proxy_fr.txt  >>  SaveRules.txt
				mv proxy_fr.txt oldproxy_fr.txt
			fi
			if [ -f dbgproxy_fr.txt ]
			then
				grep -U PERSONNELLE  dbgproxy_fr.txt  >>  SaveRules.txt
				mv dbgproxy_fr.txt olddbgproxy_fr.txt
			fi
			;;
		*)
			;;
		esac
		cp -p AutoPac_FR.msw/proxy_fr.txt proxy_fr.txt
		cp -p AutoPac_FR.msw/dbgproxy_fr.txt dbgproxy_fr.txt
		cp -p AutoPac_FR.msw/pornproxy_fr.txt pornproxy_fr.txt
		if [ -f AutoPac_FR_Old.sh ]
		then
			echo "Vous disposez d'un nouveau AutoPac_EN.sh AutoPac_EN.msw dans le dossier."
			echo Remplacer votre AutoPac_EN.sh avec le nouveau le plus tôt possible.
			echo
		fi
		echo Installation terminée. Leaving AutoPac_FR.msw avec
		echo cryptage OpenPGP signature en faveur d\'une vérification.
		echo
	else
		echo le contrôle SUCCOMBE ... sortir
		echo
	fi
else
	echo SUCCOMBE soit déroulante ou décompresser des fichiers.
	echo
fi

echo Appuyez sur Entrée pour quitter
echo
read UNUSEDRESPONSE

cd ${CURDIR}

exit


