#!/bin/bash

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

# (c) Antonio Sánchez León <introlinux[fix@]gmail[fix.]com>
# (c) Miguel Anxo Bouzada <mbouzada[fix@]gmail[fix.]com>
# (c) GALPon MinNo Team <minino[fix@]galpon[fix.]org>
# setember 2014

## -



sudo gobohide -f

case $LANG in
	ca*)
		INTRO1="\n<b>INFORMACIÓ d'interès:</b>\n\nAquest programa ajuda a configurar una xarxa local d'una aula d'informàtica."
		INTRO2="La seva simplicitat es basa en que pressuposa que l'aula està cablejada i que hi ha un servidor d'autoconfiguració per DHCP.\nSi aquest no és el teu cas, aquest procediment no et servirà de molt si no reajustas l'script a les característiques particulars de la teva xarxa."
		INTRO3="Les tasques que realitza són: configurar nom, domini, DNS i establir l'IP fixa per a l'equip, configurar Epoptes per al control de l'aula, configurar una carpeta pública compartida a l'ordinador del mestre a la qual tots els alumnes podran accedir sense contrasenya i preparar l'equip per al Sincronitzador."
		INTRO4="Aquest equip es <b>REINICIARÀ</b> automàticament en finalitzar el procés."
		TXTROOT="Has de executar aquest script amb «sudo»"
		TXT1="Tria l'opció que vols aplicar"
		BUT1="Sortir"
		BUT2="Continuar"
		ASK1="Configurar un equip principal o mestre"
		TIP1="Crea la configuració de xarxa LAN de l'equip principal de l'aula, que es correspon amb l'equip del professorat"
		ASK2="Configurar un equip alumne"
		TIP2="Crea la configuració de xarxa LAN d'un equip secundari de l'aula, que es correspon amb un equip de l'alumnat"
		ASK3="Desfer la configuració de xarxa d'aula"
		TIP3="Retira tota la configuració de xarxa LAN feta en aquest equip i torna la configuració inicial"
		TIT1="Configuració de la xarxa LAN d'una aula"
		TIT2="Avís"
		FINAL="Va acabar el procés de configuració.\n\nHas de reiniciar l'ordinador perquè els canvis tinguin efecte."
		COMPARTIDA="Compartida"
	;;
	es*)
		INTRO1="\n<b>INFORMACIÓN de interés:</b>\n\nEste programa ayuda a configurar una red local de un aula de informática."
		INTRO2="Su simplicidad se basa en que presupone que el aula está cableada y que existe un servidor de autoconfiguración por DHCP.\nSi este no es su caso, este procedimiento no le servirá de mucho a menos que reajuste el <i>script</i> a las características particulares de su red."
		INTRO3="Las tareas que realiza son: configurar nombre, dominio, DNS y establecer la IP fija para el equipo, configurar Epoptes para el control del aula, configurar una carpeta pública compartida en el ordenador del maestro a la que todos los alumnos podrán acceder sin contraseña y preparar el equipo para el Sincronizador."
		INTRO4="Este equipo se <b>REINICIARÁ</b> automáticamente al finalizar el proceso."
		TXTROOT="Tiene que ejecutar este script con «sudo»"
		TXT1="Escoja la opción que quiere aplicar"
		BUT1="Salir"
		BUT2="Continuar"
		ASK1="Configurar un equipo principal o maestro"
		TIP1="Crea la configuración de red LAN del equipo principal del aula, que se corresponde con el equipo del profesorado"
		ASK2="Configurar un equipo alumno"
		TIP2="Crea la configuración de red LAN de un equipo secundario del aula, que se corresponde con un equipo del alumnado"
		ASK3="Deshacer la configuración de red de aula"
		TIP3="Retira toda la configuración de red LAN hecha en este equipo y devuelve la configuración inicial"
		TIT1="Configuración de la red LAN de un aula"
		TIT2="Aviso"
		FINAL="Terminó el proceso de configuración.\n\nDebe reiniciar el ordenador para que los cambios tengan efecto."
		COMPARTIDA="Compartida"
	;;
	gl*)
		INTRO1="\n<b>INFORMACIÓN de interese:</b>\n\nEste programa axuda a configurar unha rede local dunha aula de informática."
		INTRO2="A súa sinxeleza basease en que presupón que a aula está cableada e que existe un servidor de autoconfiguración por DHCP.\nSe non é este o seu caso, este procedemento non servirá de moito a non ser que reaxuste o <i>script</i> ás características particulares da súa rede."
		INTRO3="As tarefas que realiza son: configurar nome, dominio, DNS e establecer un IP fixo para o equipo, configurar Epoptes para o control da aula, configurar un cartafol público compartido no computador do mestre ao que poderán acceder todos os alumnos, sen contrasinal e preparar o equipo para o Sincronizador."
		INTRO4="Este equipo <b>REINICIARASE</b> automaticamente ao rematar o proceso."
		TXTROOT="Ten que executar este script con «sudo»"
		TXT1="Escolla a opción que quere aplicar"
		BUT1="Saír"
		BUT2="Continuar"
		ASK1="Configurar un equipo principal ou mestre"
		TIP1="Crea a configuración de rede LAN do equipo principal da aula, que se corresponde co equipo do profesorado"
		ASK2="Configurar un equipo alumno"
		TIP2="Crea a configuración de rede LAN dun equipo secundario da aula, que se corresponde cun equipo do alumnado"
		ASK3="Desfacer a configuración de rede de aula"
		TIP3="Retira toda a configuración de rede LAN feita neste equipo e devolve a configuración inicial"
		TIT1="Configuración da rede LAN dunha aula"
		TIT2="Aviso"
		FINAL="Rematou o proceso de configuración.\n\nDebe reiniciar o computador para que os cambios teñan efecto."
		COMPARTIDA="Compartido"
	;;
	*)
		INTRO1="\n<b>Relevant INFORMATION:</b>\n\nThis program helps setup a local network in a computer lab."
		INTRO2="Its simplicity is based on assumption that the classroom is wired and there is a DHCP server.\nIf this is not the case, this procedure does not help you much unless you modify the <i>script</i> to the particular characteristics of your network."
		INTRO3="Tha tasks are set: name, domain, DNS and set fixed IP for the computer, configure Epoptes for classroom management, set up a shared public folder on the master computer to which all students can access without a password and prepare the computer for syncing."
		INTRO4="The system will be <b>RESTARTED</b> when the process finishes."
		TXTROOT="You must run this script with \"sudo\""
		TXT1="Choose the option you want to apply"
		BUT1="Quit"
		BUT2="Continue"
		ASK1="Configure a main or a teacher computer"
		TIP1="Create a LAN configuration of the main computer in the class, that is, a teacher computer"
		ASK2="Configure a pupil computer"
		TIP2="Create a LAN configuration of the secundary computer in the class, that is, a pupil computer"
		ASK3="Restore LAN configuration"
		TIP3="Restore all LAN configuration in this computer and go back to the inicial settings"
		TIT1="Configuration of a LAN class"
		TIT2="Warning"
		FINAL="The setup process finished.\n\nYou must restart your computer for the changes to take effect."
		COMPARTIDA="Shared"
	;;
esac


[[ $(id -u) -ne 0 ]] && {
	echo
	echo "$TXTROOT"
	echo
	yad --button="gtk-close" \
		--window-icon="face-angry"\
		--image="face-angry" \
		--title="$TIT2" \
		--text="\n\t<span size='large' color='red'><b>$TXTROOT\t</b></span>"
	exit 1
}

verificacion(){
	# ver se o usuário premeu en «Saír» ou no «X» da xanela
	ACCION="$?"
	test "$ACCION" -eq "1" || test "$ACCION" -eq "252"
	if [ "$?" -eq "0" ]; then
		exit
	fi
}
msg_intro(){
	yad \
		--image="network-workgroup" \
		--title="$TIT1" \
		--text="${INTRO1}\n\n${INTRO2}\n\n${INTRO3}\n\n<span color='red'>${INTRO4}</span>" \
		--width="400"
		
	verificacion
}

#msg_final(){
#	yad \
#		--image="network-workgroup" \
#		--title="$TIT1" \
#		--text="${FINAL}" \
#		--width="400" \
#		--button gtk-ok
#	exit
#}

show_option(){
	ESCOLLIDO=$( yad --list \
		--window-icon="network-workgroup" \
		--image="network-workgroup" \
		--title="$TIT1" \
		--text="<b>$TXT1 </b>" \
		--print-column=1 \
		--no-headers \
		--column=control:NUM \
		--column=action \
		--column=tooltip:TIP \
		--hide-column=1 \
		--width="350" \
		--height="160" \
		--button="$BUT1":1 \
		--button="$BUT2":0 \
		1 "$ASK1          " "$TIP1" \
		2 "$ASK2          " "$TIP2" \
		3 "$ASK3          " "$TIP3")

	#--image=network-workgroup \
	#--image=network-server \
	#--image=preferences-system-network 
	
	verificacion

	#captura só o numero da opción seleccionada
	ESCOLLIDO=$(echo ${ESCOLLIDO} | egrep -o '^[0-9]')

	if [ "${ESCOLLIDO}" = "" ]; then
		yad --window-icon="face-angry"\
			--image="face-angry" \
			--title="$TIT2" \
			--text "<b>$TXT2 </b>" \
			--button="$BUT3"
		show_option
	fi
}



asigna_variables(){

	USUARIO=`pwd|awk -F"/" '{print $3}'`
	GATEWAY=`ip route | awk '/default/ { print $3 }'`
	IPLOCAL=`hostname -I`
	MASK=`ifconfig |grep ${IPLOCAL}|tr ":" " "|awk '{ print $7 }'`

}

configuracion_red(){
   # DESACTIVAR EL NETWORKMANAGER
	killall nm-applet
	cd /opt/redaula
	LINEAFEA=`cat nm-applet.desktop|grep NotShowIn`
	rpl "${LINEAFEA}" "${LINEAFEA}LXDE;" nm-applet.desktop
	chown ${USUARIO}:${USUARIO} nm-applet.desktop
	
	case $LANG in
		ca*)	EQP="Equip";;
		es*)	EQP="Equipo";;
		gl*)	EQP="Equipo";;
		*)	EQP="Computer";;
	esac

   # CAMBIAR EL HOSTNAME A ALGO COMO Equipo102
	echo ${EQP}${NUMEQUIPO} > hostname

   #CAMBIAR EL HOSTS
	echo "127.0.0.1 localhost ${EQP}${NUMEQUIPO}" > hosts
	echo "127.0.1.1 ${EQP}${NUMEQUIPO}" >> hosts
	echo " " >> hosts
	echo "${GATE}.${NUMMAESTRO} server">>hosts
	echo "# The following lines are desirable for IPv6 capable hosts" >> hosts
	echo "::1     localhost ip6-localhost ip6-loopback" >> hosts
	echo "ff02::1 ip6-allnodes" >> hosts
	echo "ff02::2 ip6-allrouters" >> hosts
	

   # CAMBIAR LAS DNS QUE LAS PONE NM AUTOMÁTICAMENTE Y AHORA ESTÁ APAGADO
	echo "nameserver 8.8.8.8" > resolv.conf
	echo "nameserver 4.4.8.8" >> resolv.conf

   # CAMBIAR LA CONFIGURACIÓN DE RED
	g1=`echo ${GATEWAY}|cut -d"." -f1`
	g2=`echo ${GATEWAY}|cut -d"." -f2`
	g3=`echo ${GATEWAY}|cut -d"." -f3`
	GATE=`echo $g1.$g2.$g3`
	echo GATE:${GATE}

	echo "auto lo eth0" > interfaces
	echo "iface lo inet loopback" >> interfaces
	echo "iface eth0 inet static" >> interfaces
	echo "    address ${GATE}.${NUMEQUIPO}" >> interfaces
	echo "    netmask ${MASK}" >> interfaces
	echo "    gateway ${GATEWAY}" >> interfaces
	echo "" >> interfaces	

	# MONTAMOS SAMBA EN EL INICIO DE LXSESSION
	echo "@gvfs-mount smb://${GATE}.${NUMMAESTRO}/compartida/" >>autostart
}

#################### MAESTRO ################################################################

lan_maestro(){
	case $LANG in
		ca*)
			TIT="LAN mestre "
			TEXT1="Defineix el número de l'equip de capçalera\t\no equip <b>mestre</b>\t"
			TEXT2="<i>Aquest número ha de coincidir amb l'última\t\ntripleta de l'adreça IP \ t \ nPer exemple: <b>101</b> per a la IP 192.168.10.<b>101</b></i>"
		;;
		es*)
			TIT="LAN maestro"
			TEXT1="Defina el número del equipo de cabecera\t\no equipo <b>maestro</b>\t"
			TEXT2="<i>Este número debe coincidir con la última\t\ntripleta de la dirección IP\t\nPor ejemplo: <b>101</b> para la IP 192.168.10.<b>101</b></i>"
		;;
		gl*)
			TIT="LAN mestre"
			TEXT1="Defina o número do equipo de cabeceira\t\nou equipo <b>mestre</b>\t"
			TEXT2="<i>Este número debe coincidir coa última\t\ntripleta do enderezo IP\t\nPor exemplo: <b>101</b> para a IP 192.168.10.<b>101</b></i>"
		;;
		*)
			TIT="Teacher LAN"
			TEXT1="Difine the number for \t\the <b>teacher computer</b>\t"
			TEXT2="<i>This number should be the same as the last IP number,\t\nFor example: <b>101</b> for the IP 192.168.10.<b>101</b></i>"
		;;
	esac    


	
	asigna_variables

	#NUMEQUIPO=102 #pedir este número al usuario
	NUMEQUIPO=$(yad --entry \
		--icon=dialog-question \
		--image=preferences-system-network \
		--title "${TIT}" \
		--text "${TEXT1}\n\n${TEXT2}")

	verificacion

	echo ${USUARIO} ${IPLOCAL} ${GATEWAY} ${MASK}
	
	# HACEMOS UN DOBLE BACKUP DE TODO PARA TRASTEAR Y RESTAURAR
	mkdir -p /opt/redaula/backup
	B="/opt/redaula/backup"
	rsync -a /etc/hostname "${B}"
	rsync -a /etc/hosts "${B}"
	rsync -a /etc/resolv.conf "${B}"
	rsync -a /etc/network/interfaces "${B}"
	rsync -a /home/${USUARIO}/.config/autostart/nm-applet.desktop "${B}"
	rsync -a /home/$USUARIO/.gtk-bookmarks "${B}"/gtk-bookmarks
	rsync -a /home/$USUARIO/.config/lxsession/PICAROS/autostart "${B}"/autostart
	cp -a "${B}"/* /opt/redaula

	cd /opt/redaula
	touch maestro
	
	configuracion_red         #<-------------- Modificamos todos los archivos de /opt/redaula/


	# CREA LA CARPETA COMPARTIDA
	#mkdir /home/${USUARIO}/${COMPARTIDA}
	chmod -R 775 /home/$USUARIO/${COMPARTIDA}

	# COPIAR LOS ARCHIVOS MODIFICADOS CADA UNO A SU SITIO
	rsync -a /opt/redaula/hostname /etc/hostname
	rsync -a /opt/redaula/resolv.conf /etc/resolv.conf
	rsync -a /opt/redaula/interfaces /etc/network/interfaces
	rsync -a /opt/redaula/nm-applet.desktop /home/${USUARIO}/.config/autostart/nm-applet.desktop
	rsync -a /opt/redaula/hosts /etc/hosts
	rsync -a /opt/redaula/autostart /home/${USUARIO}/.config/lxsession/PICAROS/autostart
	# RESETEAMOS LA RED PARA QUE TOME LOS NUEVOS VALORES
	service hostname.sh start
	ip addr flush dev eth0
	service networking restart
	
	# CAMBIAR LA CONFIGURACIÓN DE EPOPTES: EQUIPO MAESTRO
	chkconfig epoptes 2
	/etc/init.d/epoptes start
	chkconfig samba 2
	/etc/init.d/samba start
	chkconfig ssh 2
	/etc/init.d/ssh start
	ssh-keygen -t rsa -f /root/.ssh/id_rsa -q -N ""
	
}

#################### ALUMNO ################################################################

lan_alumno(){
	case $LANG in
		ca*)
			TIT="LAN alumne"
			TEXT1="Aquests números han de coincidir amb l'última tripleta de l'adreça IP\t\n\tPer exemple: <b>101</b>per a la IP 192.168.10.<b>101</i>"
			TEXT2="<i> En el camp «Equip <b>mestre</b> »escriu el ja indicat en l'equip mestre</i>"
			FIELD1="Equip <b>alumne</b>"
			FIELD2="Equip <b>mestre</b>"
			NOTA="Escriu el mateix l'equip mestre"
		;;
		es*)
			TIT="LAN alumno"
			TEXT1="Este número debe coincidir con el último número de la dirección IP\t\n\tPor ejemplo: <b>101</b> para la IP 192.168.10.<b>101</i>"
			TEXT2="<i>En el campo «Equipo <b>maestro</b>» escriba el ya indicado en el equipo maestro</i>"
			FIELD1="Equipo <b>alumno</b>"
			FIELD2="Equipo <b>maestro</b>"
		;;
		gl*)
			TIT="LAN alumno"
			TEXT1="Estes números deben coincidir coa última tripleta do enderezo IP\t\n\tPor exemplo: <b>101</b> para o IP 192.168.10.<b>101</b>"
			TEXT2="<i>No campo «Equipo <b>mestre</b>» escriba o xa indicado no equipo mestre</i>"
			FIELD1="Equipo <b>alumno</b>"
			FIELD2="Equipo <b>mestre</b>"
		;;
		*)
			TIT="Pupil LAN"
			TEXT1="This number should be the same as the last of IP address\t\n\tFor example: "
			TEXT2="<i>In the «<b>teacher</b> computer» input the name already put in the teacher computer</i>"
			FIELD1="<b>Pupil</b> computer"
			FIELD2="<b>Teacher</b> computer"
		;;
	esac


	asigna_variables

	#NUMEQUIPO=102 #pedir este número al usuario
	#NUMMAESTRO=21 #pedir el número del equipo maestro también para configurar epoptes
	NUMsEQUIPOs=$(yad \
		--icon=dialog-question \
		--image=preferences-system-network \
		--title "${TIT}" \
		--text "${TEXT1}\n\n${TEXT2}" \
		--form \
			--field="${FIELD1}" \
			--field="${FIELD2}")
	verificacion		
	# NUMsEQUIPOs devuelve: entry-field-1|entry-field-2|
	NUMEQUIPO=`echo ${NUMsEQUIPOs} | awk -F "|" '{print $1;}'`
	NUMMAESTRO=`echo ${NUMsEQUIPOs} | awk -F "|" '{print $2;}'`

	

	echo ${USUARIO} ${IPLOCAL} ${GATEWAY} ${MASK}


	# HACEMOS UN DOBLE BACKUP DE TODO PARA TRASTEAR Y RESTAURAR
	mkdir -p /opt/redaula/backup
	B="/opt/redaula/backup"
	rsync -a /etc/hostname "${B}"
	rsync -a /etc/hosts "${B}"
	rsync -a /etc/resolv.conf "${B}"
	rsync -a /etc/network/interfaces "${B}"
	rsync -a /home/${USUARIO}/.config/autostart/nm-applet.desktop "${B}"
	rsync -a /home/$USUARIO/.config/autostart/epoptes-client.desktop "${B}"
	rsync -a /etc/default/epoptes-client "${B}"
	rsync -a /home/$USUARIO/.gtk-bookmarks "${B}"/gtk-bookmarks
	rsync -a /home/$USUARIO/.config/lxsession/PICAROS/autostart "${B}"/autostart
	cp -a "${B}"/* /opt/redaula	

	cd /opt/redaula
	touch alumno

	configuracion_red                   #<-------------- Modificamos todos los archivos de /opt/redaula/ 

	# CAMBIAR LA CONFIGURACIÓN DE EPOPTES ESTA PARTE SÓLO ES PARA LOS ALUMNOS NO PARA EL EQUIPO MAESTRO
	echo "SERVER=${GATE}.${NUMMAESTRO}">epoptes-client

	# AÑADIR EL MARCADOR DE LA CARPETA COMPARTIDA

	#mkdir /home/$USUARIO/${COMPARTIDA}
	#chmod -R 775 /home/$USUARIO/${COMPARTIDA}

	echo "smb://${GATE}.${NUMMAESTRO}/${COMPARTIDA}/ ${COMPARTIDA}">>/home/$USUARIO/.gtk-bookmarks

	

	LINEAFEA=`cat epoptes-client.desktop|grep NotShowIn`
	rpl "${LINEAFEA}" "NotShowIn=KDE;" epoptes-client.desktop
	chown $USUARIO:$USUARIO epoptes-client.desktop

	# COPIAR LOS ARCHIVOS MODIFICADOS CADA UNO A SU SITIO
	rsync -a /opt/redaula/hostname /etc/hostname
	rsync -a /opt/redaula/hosts /etc/hosts
	rsync -a /opt/redaula/resolv.conf /etc/resolv.conf
	rsync -a /opt/redaula/interfaces /etc/network/interfaces
	rsync -a /opt/redaula/nm-applet.desktop /home/${USUARIO}/.config/autostart/nm-applet.desktop
	rsync -a /opt/redaula/epoptes-client.desktop /home/${USUARIO}/.config/autostart/epoptes-client.desktop
	rsync -a /opt/redaula/epoptes-client /etc/default/epoptes-client
	rsync -a /opt/redaula/autostart /home/${USUARIO}/.config/lxsession/PICAROS/autostart
	# Aquí actualizamos el lanzador "Compartida"


	mv /home/${USUARIO}/${COMPARTIDA} "${B}"

	echo '#!/bin/bash' >/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun
	echo "cierralanzador" >/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun
	echo "caja --no-desktop smb://${GATE}.${NUMMAESTRO}/${COMPARTIDA}/" >>/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun


	# RESETEAMOS LA RED PARA QUE TOME LOS NUEVOS VALORES
	service hostname.sh start
	ip addr flush dev eth0
	service networking restart

	# LANZAMOS EPOPTES
	/usr/sbin/epoptes-client
	chkconfig ssh 2
	/etc/init.d/ssh start
	
}

lan_restaura(){

	case $LANG in
		ca*)	COMPARTIDA="Compartida";;
		es*)	COMPARTIDA="Compartida";;
		gl*)	COMPARTIDA="Compartido";;
		*)	COMPARTIDA="Shared";;
	esac


	cd /opt/redaula/

	B="/opt/redaula/backup"

	# COMÚN A CUALQUIER EQUIPO
	rsync -a "${B}"/resolv.conf /etc/resolv.conf
	rsync -a "${B}"/hosts /etc/hosts
	rsync -a "${B}"/hostname /etc/hostname
	rsync -a "${B}"/interfaces /etc/network/interfaces
	rsync -a "${B}"/nm-applet.desktop /home/$USUARIO/.config/autostart/nm-applet.desktop
	rsync -a "${B}"/autostart /home/${USUARIO}/.config/lxsession/PICAROS/autostart
	
	# SI ES UN EQUIPO DE ALUMNO, ADEMÁS:
	if [ -e alumno ];then
		rsync -a "${B}"/epoptes-client.desktop /home/$USUARIO/.config/autostart/epoptes-client.desktop
		rsync -a "${B}"/epoptes-client /etc/default/epoptes-client
		rsync -a "${B}"/gtk-bookmarks /home/$USUARIO/.gtk-bookmarks
	
		mv "${B}"/$COMPARTIDA /home/${USUARIO}/$COMPARTIDA
		echo '#!/bin/bash' >/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun
		echo "cierralanzador" >/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun
		echo "caja --no-desktop /home/$USUARIO/${COMPARTIDA}/" >>/usr/local/share/miniapps/Places/${COMPARTIDA}/AppRun


		chkconfig -d ssh
		rm -r /home/$USUARIO/.ssh
		killall epoptes-client
	fi

	# SI ES EL EQUIPO DEL MAESTRO, ADEMÁS:
	if [ -e maestro ];then
		chkconfig -d epoptes
		chkconfig -d samba
		chkconfig -d ssh
		rm -r /root/.ssh
		killall epoptes
	fi

	nm-applet&

	sudo rm -r /opt/redaula

}

execution_func(){
# de acordo coa opción seleccionada, executa o proceso correspondente
case "$ESCOLLIDO" in
	1)	lan_maestro
		
;;
	2)	lan_alumno
		
;;
	3)	lan_restaura
		
;;
esac
}

msg_intro
show_option
execution_func
#msg_final
reboot

#.EOF
