#!/usr/bin/sh
WGET="$(which wget)"

$WGET -q --tries=20 --timeout=10 http://www.google.com -O /tmp/google.idx &> /dev/null
if [ ! -s /tmp/google.idx ]; then
    echo "ERROR: No internet connection detected.
In order to display About Mageia page you should have an working connection."
	exit 1
else
	for lang in `echo $LANG:$LANGUAGE | tr ':' ' ' | cut -d'_' -f1` ; do
	    $WGET -q --tries=20 --timeout=10 http://www.mageia.org/$lang/about -O /tmp/mageiaorg.idx &> /dev/null
	    if [ ! -s /tmp/mageiaorg.idx ]; then
	        echo "WARNING: There is no localized Mageia About web page;
displaying English web page"
            xdg-open "http://www.mageia.org/en/about"
        else
            xdg-open "http://www.mageia.org/$lang/about"
            exit 0
        fi
	done
fi
