Instalacion-LibreOffice/monitor-libreoffice.sh

163 lines
8.7 KiB
Bash
Raw Permalink Normal View History

2024-05-13 08:28:25 -06:00
#!/bin/sh
#data=date
exec >& >(tee -a /tmp/"$data"-logupdatelibreoffice.txt)
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/games:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
#export DISPLAY=0.0
curl http://linorg.usp.br/LibreOffice/libreoffice/stable/ > /tmp/version1
tail -4 /tmp/version1 > /tmp/version2
head -1 /tmp/version2 > /tmp/version3
cut -d= -f 5 /tmp/version3 > /tmp/version4
cat /tmp/version4 | cut -c 2-6 > /tmp/libreoffice-ultima-version
/usr/bin/libreoffice* --version > /tmp/version-instalada ; cat /tmp/version-instalada | cut -c 12-17 /tmp/version-instalada > /tmp/comparar-version-instalada
sed 's/\.//g' /tmp/libreoffice-ultima-version > /tmp/Ultimaversion
sed 's/\.//g' /tmp/comparar-version-instalada > /tmp/versionLocal
value=`cat /tmp/Ultimaversion`
value2=`cat /tmp/versionLocal`
if [ "$value" -gt "$value2" ];
then
#1 Variable definiendo que bajaremos LibreOffice del repositorio estable
## Escogiendo la versión de LibreOffice
#2 Aqui pudee ingresar una lista de tus servidoes preferidos para bajar LibreOFfice, con la posibilidad de ingresar un servidor local, ideal para ambientes empresariales
#En este caso utilicé el servidor de mi rede con IP 192.168.50.122/tdf
#Escoge el servidor para descargar LibreOffice."
# "http://tdf.c3sl.ufpr.br" "UFPR "
# "http://linorg.usp.br/LibreOffice" "USP "
# "http://ftp.unicamp.br/pub" "UNICAMP "
# "http://mirror.pop-sc.rnp.br/mirror/tdf" "PoP-SC "
# "http://mirror.nexcess.net/tdf" "Mirror nexcess"
# "http://mirror.ufms.br/tdf" "Mirror UFMS"
# "http://tdf.ufes.br/" "Mirror UFES"
# "http://mirror.unesp.br/tdf" "Mirror Unesp"
# "192.168.50.122/tdf" "Servidor Local "
#3 Probando el gestor de paquetes"
if [ -e /usr/bin/rpm ]; then
gestorPaquetes=rpm
directorio=RPMS
else
gestorPaquetes=deb
directorio=DEBS
fi
#4 Verificando arquitetura del sistema"
if [ `getconf LONG_BIT` = "64" ];
then
plataforma=x86_64
plataforma2=x86-64
else
plataforma=x86
plataforma2=x86
fi
#5 Escogiendo idioma local
servidor="192.168.0.187/tdf"
estadoversion="stable"
vs=`cat /tmp/libreoffice-ultima-version`
idioma="es"
# "Lista de idiomas diposnibles
# "pt-BR" "Portuguese (Brazil)"
# "am" "Amharic - አማርኛ"
# "ar" "Arabic - العربية "
# "ast" "Asturian"
# "bg" "Bulgarian (Bulsgaria) "
# "bn-IN" "Bengali, India"
# "bn" "Bengali"
# "bo" "Tibetan Standard - བོད་ཡིག"
# "bs" "Bosnian (Bosnia and Herzegovina)"
# "ca" "Catalan"
# "cs" "Czech"
# "da" "Danish"
# "de" "German"
# "dz" "Dzongkha"
# "el" "Greek"
# "en-US" "English United Stats"
# "en-GB" "English (United Kingdom)" \
# "en-ZA" "English (South Africa)"
# "eo" "Esperanto"
# "es" "Spanish"
# "et" "Estonian"
# "eu" "Basque"
# "fi" "Finnish"
# "fr" "French"
# "gl" "Galician"
# "gu" "Gujarati"
# "he" "Hebrew"
# "hi" "Hindi"
# "hr" "Croatian"
# "hu" "Hungarian"
# "id" "Indonesian"
# "is" "Icelandic"
# "it" "Italian"
# "ja" "Japanese"
# "ka" "Georgian"
# "km" "Khmer"
# "ko" "Korean"
# "lo" "Lao"
# "lt" "Lithuanian"
# "lv" "Latvian"
# "mk" "FYRO Macedonian"
# "nb" "Norwegian (Bokm?l)"
# "ne" "Nepali"
# "nl" "Dutch"
# "nn" "Norwegian Nynorsk"
# "om" "Oromo"
# "pl" "Polish"
# "pt" "Portuguese"
# "ro" "Romanian"
# "ru" "Russian"
# "si" "Sinhala; Sinhalese"
# "sid" "Sidamo"
# "sk" "Slovak"
# "sl" "Slovenian"
# "sq" "Albanian"
# "sv" "Swedish"
# "ta" "Tamil"
# "tg" "Tajik"
# "tr" "Turkish"
# "ug" "Uyghur"
# "uk" "Ukrainian"
# "vi" "Vietnamese (Viet Nam)"
# "zh-CN" "Chinese Simplified"
# "zh-TW" "Chinese Traditional" OFF 3>&1 1>&2 2>&3)
# status=$?
#touch /home/~/papeleraratemp
/usr/bin/zenity --question --text="La versión "$vs" está disponible, ¿desea actualizar?" --ok-label="Si" --cancel-label="No"
#xterm -title 'Actualizar LibreOffice' -e " read PASSWD ; echo "echo $PASSWD |pwd""
if [ $? = 0 ];
then
if [-e /usr/bin/dnf ]; then
xterm -e "bash /usr/bin/instalador-libreoffice.sh" && zenity --info --title "Atualización" --width=200 --height=100 --text 'LibreOffice fue actualizado haga clic en OK para salír'
elif [-e /usr/bin/zypper ]; then
xterm -e "sudo bash /usr/bin/instalador-libreoffice.sh" && zenity --info --title "Atualización" --width=200 --height=100 --text 'LibreOffice fue actualizado haga clic en OK para salír'
else
xterm -e "sudo bash /usr/bin/instalador-libreoffice.sh" && zenity --info --title "Atualización" --width=200 --height=100 --text 'LibreOffice fue actualizado haga clic en OK para salír'
fi
else
exit 1
fi
else
echo "tienes la versión más actual" > /var/log/backup.log
fi