#!/bin/bash

# This script is licensed under GPL v3 or higher
# Author: 	Angel Berlanas Vicente 
# 		<angel.berlanas@gmail.com>


# Bash power!
NET_MIRROR_PATH="/net/mirror/llx1406/"
NET_MIRROR_PATH_CONF="$NET_MIRROR_PATH/conf"
TEXTDOMAIN="lliurex-up"

do_sanity_checks()
{
	if [ -x /usr/sbin/lliurex-mirror-non-gtk ] ; then
		echo "Sanity checks operations"
		/usr/sbin/lliurex-mirror-non-gtk  do_sanity_checks
	fi
}

show_message()
{
	rc=0
	zenity --question --text=$"A LliureX replica has been detected\!\n\nMaking or upgrading the LliureX replica is highly recommended, this facilitates and enables many tasks performed in the classroom, such as thin clients.\n\n Do you want to make the replica right now\? (this might take a while as it needs to download 8-19 GB)" --cancel-label=$"Not at this moment" --ok-label=$"Ok! Seems amazing!" || rc=1
	
	if [ $rc -eq 0 ] ; then 
		lliurex-mirror-gui
	else 
		echo "Nothing to do"
	fi
}



#
# MAIN 
#

do_sanity_checks
show_message