From 968e9ecb336adec78b5b30546e2454fd50c23c75 Mon Sep 17 00:00:00 2001
From: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
Date: Thu, 2 Jul 2015 19:50:27 -0300
Subject: [PATCH] Fix verification for wine repository

Signed-off-by: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
---
 windows-installer/install-essencials.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/windows-installer/install-essencials.sh b/windows-installer/install-essencials.sh
index 493c37d..26b828f 100755
--- a/windows-installer/install-essencials.sh
+++ b/windows-installer/install-essencials.sh
@@ -3,12 +3,16 @@
 REQUIRED_PKGS="wine gcc-mingw-w64 p7zip-full autoconf"
 pkgs_to_install=""
 for pkg in $REQUIRED_PKGS; do
-    if ! dpkg --get-selections $pkg | grep -q -w install$; then
+    if ! dpkg --get-selections $pkg | grep -q -w 'install$'; then
         pkgs_to_install="$pkgs_to_install $pkg"
     fi
 done
 
-test -z $pkgs_to_install || sudo add-apt-repository ppa:ubuntu-wine/ppa || sudo update apt-get installsudo apt-get install $pkgs_to_install -y
+if test -n "$pkgs_to_install"; then
+    sudo add-apt-repository ppa:ubuntu-wine/ppa
+    sudo apt-get update update
+    sudo apt-get install $pkgs_to_install -y
+fi
 
 required_wine_pkgs="/tmp/nsis-2.45.exe /tmp/python-2.7.5.msi /tmp/py2exe.exe /tmp/pywin32.exe /tmp/wmi.exe"
 
@@ -49,4 +53,4 @@ if ! test -f ~/.wine/drive_c/Program\ Files/NSIS/Unicode/Plugins/KillProcDLL.dll
     wget "http://downloads.sourceforge.net/project/findkillprocuni/bin/KillProcDLL%20Unicode%20bin.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffindkillprocuni%2Ffiles%2Fbin%2F&ts=1395250878&use_mirror=ufpr" -O "/tmp/KillProcDLL.zip"
     unzip -u -d "/tmp/KillProcDLL" "/tmp/KillProcDLL.zip"
     cp "/tmp/KillProcDLL/KillProcDLL.dll" ~/.wine/drive_c/Program\ Files/NSIS/Unicode/Plugins/
-fi
\ No newline at end of file
+fi
-- 
GitLab