From f1dfc15937f9152a87aa61339adb6fc760dea4b7 Mon Sep 17 00:00:00 2001 From: Erickson Silva Date: Thu, 31 Mar 2016 21:22:12 -0300 Subject: [PATCH] Adiciona scripts de execução e atualização do VLibras --- script/depends_install.sh | 22 ++++++++++++++++++++++ script/depends_vlibras.sh | 0 script/launcher.sh | 31 +++++++++++++++++++++++++++++++ script/update_dict.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ script/update_vlibras.sh | 32 ++++++++++++++++++-------------- 5 files changed, 115 insertions(+), 14 deletions(-) create mode 100755 script/depends_install.sh mode change 100644 => 100755 script/depends_vlibras.sh create mode 100755 script/launcher.sh create mode 100755 script/update_dict.sh diff --git a/script/depends_install.sh b/script/depends_install.sh new file mode 100755 index 0000000..c866b6c --- /dev/null +++ b/script/depends_install.sh @@ -0,0 +1,22 @@ +#! /bin/sh +set -e +notify-send -u critical -i "/opt/vlibras_desktop/vlibras_player_Data/Resources/UnityPlayer.png" VLibras "Aguarde enquanto as dependências do VLibras são instaladas... +Isso pode levar alguns minutos!" + +case $1 in + '') + eval "$(debconf-apt-progress --config)" + "$0" debconf + ;; + debconf) + . /usr/share/debconf/confmodule + debconf-apt-progress --start + debconf-apt-progress --from 0 --to 30 -- apt-get update + debconf-apt-progress --from 30 --to 50 -- apt-get install --force-yes --yes vlibras-aelius + debconf-apt-progress --from 50 --to 100 -- apt-get install --force-yes --yes dicionario-vlibras:i386 + debconf-apt-progress --stop + ;; +esac + +notify-send -u critical -i "/opt/vlibras_desktop/vlibras_player_Data/Resources/UnityPlayer.png" +VLibras-Desktop "As dependências foram instaladas e o VLibras está pronto para ser usado!" diff --git a/script/depends_vlibras.sh b/script/depends_vlibras.sh old mode 100644 new mode 100755 index 6d4bbcb..6d4bbcb --- a/script/depends_vlibras.sh +++ b/script/depends_vlibras.sh diff --git a/script/launcher.sh b/script/launcher.sh new file mode 100755 index 0000000..15d6e31 --- /dev/null +++ b/script/launcher.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +function check_exported_variable () +{ + outline=$(printenv | grep $1) + if [[ "" == "$outline" ]] || [[ ! "$outline" =~ "vlibras" ]]; then + eval 'export '$1'='$2 + fi +} + +check_exported_variable "HUNPOS_TAGGER" "/opt/vlibras_aelius/bin/hunpos-tag" +check_exported_variable "AELIUS_DATA" "/opt/vlibras_aelius/aelius_data" +check_exported_variable "NLTK_DATA" "/opt/vlibras_aelius/nltk_data" +check_exported_variable "TRANSLATE_DATA" "/opt/vlibras_desktop/translate/data/" +check_exported_variable "PYTHONPATH" "/opt/vlibras_desktop/translate:/opt/vlibras_aelius:${PYTHONPATH}" + +PKG_DICT=$(dpkg-query -W --showformat='${Status}\n' dicionario-vlibras:i386 | grep "install ok installed") +PKG_AELIUS=$(dpkg-query -W --showformat='${Status}\n' vlibras-aelius | grep "install ok installed") + +if [ "" != "$PKG_DICT" ]; then + PKG_DICT_VERSION=$(apt-cache show patch1.0.0:i386 | grep "MD5sum" | awk '{ print $2 }') + if [ "$PKG_DICT_VERSION" == "2e60f8a56018f3c756ffa0c282766c2b" ]; then + gksudo -m "Uma atualização necessária foi encontrada! Digite sua senha para instalar." "gnome-terminal --hide-menubar -x bash -c 'apt-get clean && apt-get update && apt-get install --reinstall --force-yes --yes patch1.0.0:i386;'" + fi +fi + +if [ "" == "$PKG_DICT" ] || [ "" == "$PKG_AELIUS" ]; then + gksudo -m "Uma atualização necessária foi encontrada! Digite sua senha para instalar." "gnome-terminal --hide-menubar -x bash -c '/./opt/vlibras_desktop/script/depends_install.sh;'" +fi + +/./opt/vlibras_desktop/vlibras_player -single-instance > /dev/null 2>&1 \ No newline at end of file diff --git a/script/update_dict.sh b/script/update_dict.sh new file mode 100755 index 0000000..b748f2f --- /dev/null +++ b/script/update_dict.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# +#-------------------- IMPORTANT ------------------------ +# -> To run this script you need to be a sudo user | +#------------------------------------------------------- + +set -e + +notify-send -u critical -i "/opt/vlibras_desktop/vlibras_player_Data/Resources/UnityPlayer.png" VLibras "As atualizações do dicionário estão sendo instaladas..." + +function check_update_patches() +{ + DIR="/opt/vlibras_desktop/vlibras_player_Data/Bundles" + count=0 + for d in "$DIR/*" ; do + count=$((count+1)) + apt-get install --only-upgrade --force-yes --yes patch${count}.0.0 > /dev/null 2>&1 + done +} + +case $1 in + '') + eval "$(debconf-apt-progress --config)" + "$0" debconf + ;; + debconf) + . /usr/share/debconf/confmodule + + PKG_DICT_VERSION=$(apt-cache show patch1.0.0:i386 | grep "MD5sum" | awk '{ print $2 }') + if [ "$PKG_DICT_VERSION" == "2e60f8a56018f3c756ffa0c282766c2b" ]; then + apt-get clean + apt-get update + apt-get install --reinstall --force-yes --yes patch1.0.0:i386 + fi + + # Start upgrade of the dictionary + debconf-apt-progress --start + debconf-apt-progress --from 0 --to 30 -- apt-get update + check_update_patches + debconf-apt-progress --from 30 --to 100 -- apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386 + debconf-apt-progress --stop + ;; +esac diff --git a/script/update_vlibras.sh b/script/update_vlibras.sh index 6653f73..ceb6bf3 100755 --- a/script/update_vlibras.sh +++ b/script/update_vlibras.sh @@ -5,19 +5,23 @@ # -> To run this script you need to be a sudo user | #------------------------------------------------------- -# Update the list of repositories -apt-get update +set -e -if [ $1 == "vlibras-desktop" ]; then - # Install the new version of vlibras-desktop - notify-send -u critical "O VLibras está sendo atualizado! Aguarde..." - #apt-get install --only-upgrade vlibras-desktop -else - if [ $1 == "dicionario-vlibras" ]; then - # Install the new version of dicionario-vlibras - notify-send -u critical "O Dicionário de sinais do VLibras está sendo atualizado..." - #apt-get install --only-upgrade dicionario-vlibras - fi -fi +notify-send -u critical -i "/opt/vlibras_desktop/vlibras_player_Data/Resources/UnityPlayer.png" VLibras "Aguarde! As atualizações do VLibras estão sendo instaladas... +Isso pode levar alguns minutos!" -/./opt/vlibras_desktop/script/launcher.sh \ No newline at end of file +case $1 in + '') + eval "$(debconf-apt-progress --config)" + "$0" debconf + ;; + debconf) + . /usr/share/debconf/confmodule + debconf-apt-progress --start + debconf-apt-progress --from 0 --to 25 -- apt-get update + debconf-apt-progress --from 25 --to 50 -- apt-get install --only-upgrade --force-yes --yes vlibras-desktop + debconf-apt-progress --from 50 --to 75 -- apt-get install --only-upgrade --force-yes --yes vlibras-aelius + debconf-apt-progress --from 75 --to 100 -- apt-get install --only-upgrade --force-yes --yes dicionario-vlibras:i386 + debconf-apt-progress --stop + ;; +esac -- libgit2 0.21.2