#!/bin/bash
# This script is licensed under GPLv3 or higher
#
# Test lliurex-mirror executable, for servers.
if [ -x /usr/sbin/lliurex-up-mirror ] ; then
gksu /usr/sbin/lliurex-up-mirror
fi
# Get the apt-cache's cache status.
# FIXME
# This method is enough dirty for my style.
apt-get check > /tmp/lliurex-up-check.log
numero_lineas=$(cat /tmp/lliurex-up-check.log | wc -l)
if [ ${numero_lineas} -gt 3 ] ; then
echo "Hi ha errors als paquets, per a arreglar-los proveu a executar des del Terminal:
sudo lliurex-upgrade
o marqueu la casella perquè s'arreglen automàticament."> /tmp/lliurex-up-check-head.log
echo "
" >> /tmp/lliurex-up-check-head.log
echo "
" >> /tmp/lliurex-up-check-head.log
echo "Detalls:" >> /tmp/lliurex-up-check-head.log
echo "
" >> /tmp/lliurex-up-check-head.log
echo "" >> /tmp/lliurex-up-check-head.log
cat /tmp/lliurex-up-check.log >> /tmp/lliurex-up-check-head.log
echo "">> /tmp/lliurex-up-check-head.log
rc=0
zenity --text-info --html --filename="/tmp/lliurex-up-check-head.log" --checkbox="Arregla'ls automàticament" || rc=1
if [ $rc -eq 0 ]; then
gnome-terminal -e "lliurex-upgrade"
fi
exit 0
fi
# At the end, if all is done, lliurex-up is ready
gksu /usr/share/lliurex-up/gui/lliurex-up