#!/bin/bash

###################  Jungle-team   ######################
#                  jungle-team.es                       #
######################################################### 

UDPXY="https://raw.githubusercontent.com/jungla-team/utilidades/master/udpxy.tar.gz"

VERDE='\033[0;32m'
ROJO='\033[0;31m'
NC='\033[0m'


function Mensaje() {
	echo -e "$2$1${NC}"
}

function Error() {
	echo -e "\n\a  ${ROJO} $1${NC}" 1>&2
	exit 1
}

function CompruebaInternet() {

	wget -q --spider http://google.com
	
	if [ $? -ne 0 ]; then
		Error "Es necesario disponer de conexiÛn a Internet{NC}"
	fi

}

function Instalacionfeed() {

	Mensaje "Se procede a la instalacion de udpxy en imagen VTI arm....." $VERDE

 }


function udpxy() {
	
    if [ 'uname -a | grep -i arm' != "" ]; 
    then
        wget $UDPXY -P /tmp/
        tar -xzvf /tmp/udpxy.tar.gz -C /
    else
        Mensaje "Su receptor con imagen vti no es arm....." $VERDE
        exit
    fi
    
      
}




function permisos() {

	chmod 777 /usr/bin/udpxy
    chmod 777 /etc/init.d/udpxy
    ln -s /etc/init.d/udpxy /etc/rc3.d/S98udpxy
    /etc/init.d/udpxy start
}


function logo(){
	clear
	echo -e "\e[32m${VERDE} ******************************************************************************\e[0m"
	echo -e "\e[32m${VERDE} *      _ _    _ _   _  _____ _      ______   _______ ______          __  __  *\e[0m"
    echo -e "\e[32m${VERDE} *     | | |  | | \ | |/ ____| |    |  ____| |__   __|  ____|   /\   |  \/  | *\e[0m"
    echo -e "\e[32m${VERDE} *     | | |  | |  \| | |  __| |    | |__ ______| |  | |__     /  \  | \  / | *\e[0m"
    echo -e "\e[32m${VERDE} *  _  | | |  | |     | | |_ | |    |  __|______| |  |  __|   / /\ \ | |\/| | *\e[0m"
    echo -e "\e[32m${VERDE} * | |_| | |__| | |\  | |__| | |____| |____     | |  | |____ / ____ \| |  | | *\e[0m"
    echo -e "\e[32m${VERDE} * \____/ \____/|_| \_|\_____|______|______|    |_|  |______/_/    \_\_|  |_| *\e[0m"        
	echo -e "\e[32m${VERDE} *        																	 *\e[0m"
	echo -e "\e[32m${VERDE} *                          Instalador jungle  utilidades					 *\e[0m"
	echo -e "\e[32m${VERDE} *      grupo telegram: https://t.me/joinchat/Bv0_2hZ8jH6dsUJFoYG-Rg          *\e[0m"
	echo -e "\e[32m${VERDE} *                                                                            *\e[0m"
	echo -e "\e[32m${VERDE} *                           jungle-team.com                                  *\e[0m"
	echo -e "\e[32m${VERDE} ******************************************************************************\e[0m"
}

logo

CompruebaInternet

Instalacionfeed

udpxy

permisos


Mensaje "Gracias por haber usado el instalador Jungle-Team visite https://t.me/joinchat/Bv0_2hZ8jH6dsUJFoYG-Rg para soporte" $ROJO
