Skip to content
Snippets Groups Projects
Commit a29bf875 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci
Browse files

Merge remote branch 'windows-installer/master'

parents 344b865c 66fcb764
No related branches found
No related tags found
No related merge requests found
C3SL - Centro de Computacao Cientifica e Software Livre
Agtha Cristina de Nadai
Adriano da Luz
Aryane Ast dos Santos
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Eduardo Cunha de Almeida
Erik Alexandre Pucci
Fabiano Silva
Felipe Cys Laskoski
Guilherme Zasyeki Machado
Jorge Augusto Meira
Josiney de Souza
Juliana Bueno
Klismann Smoger Mottin
Luis Carlos Erpen de Bona
Marcos Castilho
Marcos Sunye
Pedro Eugenio Rocha
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Victor Tarabola Cortiano
Vinicius Kwiecien Ruoso
This diff is collapsed.
MAKENSIS = makensis-utf8.exe
WININSTDIR = $(PWD)
SRCDIR = $(WININSTDIR)/src
BUILDDIR = $(WININSTDIR)/build
BINDIR = $(WININSTDIR)/bin
CLIENTDIR = $(WININSTDIR)/../git/client
CLIENTBIN = $(CLIENTDIR)/bin/client.exe
GETSCHOOLINFODIR = $(WININSTDIR)/../buildpackage/proinfodatadeb/getSchoolInfo
GETSCHOOLINFOBIN = $(WININSTDIR)/../buildpackage/proinfodatadeb/package/usr/local/bin/getSchoolInfo.exe
INSTALLERSRC = $(SRCDIR)/installer.nsi
COLLECTDIR = $(WININSTDIR)/../windows-coleta
all: client getinfo collect installer
client:
@cd $(CLIENTDIR) && make win
@cp $(CLIENTBIN) $(BINDIR)
getinfo:
@cd $(GETSCHOOLINFODIR) && make win
@cp $(GETSCHOOLINFOBIN) $(BINDIR)
collect:
@cd $(COLLECTDIR) && make
installer:
@cd $(SRCDIR)
@mkdir -p $(BUILDDIR)
@$(MAKENSIS) $(INSTALLERSRC)
README
======
- Create a Makefile to compile the installer.nsi
- Add coleta-windows files to the installer
windows-installer/images/headerLeft.bmp

25.7 KiB

windows-installer/images/proinfodata.ico

25.6 KiB

windows-installer/images/wizard.bmp

151 KiB

; Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre
; Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
;
; This file is part of ProInfoData Windows Installer
;
; ProInfoData Windows Installer is free software you can redistribute it
; and/or modify it under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
; USA.
;Used variables
; R0 -> General use
; R1 -> General use
; R2 -> Temp variable
; R3 -> Variable used to set the lock state of the "next" button in INEP page
; R4 -> proxyHost pointer
; R5 -> proxyPort pointer
; R6 -> proxyUser pointer
; R7 -> proxyPass pointer
!define PRODUCT_NAME "ProInfoData"
!define PRODUCT_VERSION "0.0.2"
!define PRODUCT_PUBLISHER "C3SL - UFPR"
!define PRODUCT_WEB_SITE "http://seed.c3sl.ufpr.br/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\\
Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_UNINST_NAME "Desinstalar ${PRODUCT_NAME}"
!define PRODUCT_TASK "$PROGRAMFILES\${PRODUCT_NAME}\bin\agent\proinfodataAgent.exe"
!define MUI_FINISHPAGE_NOAUTOCLOSE
SetCompressor bzip2
RequestExecutionLevel admin
XPStyle on
BrandingText "ProInfoData - C3SL"
;Installer headers
!include "nsDialogs.nsh"
!include "MUI.nsh"
;Installer images
!define MUI_ICON "..\images\proinfodata.ico"
!define MUI_UNICON "..\images\proinfodata.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "..\images\wizard.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "..\images\headerLeft.bmp"
;MUI Settings
!define MUI_ABORTWARNING
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "../COPYING"
Page custom PROXY_1 proxyLeave
Page custom PROXY_2 proxyInfo
Page custom INEP
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
;Language files
!insertmacro MUI_LANGUAGE "PortugueseBR"
;Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
;MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "..\build\${PRODUCT_NAME}.exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
Var Dialog
Var Inep
Var ReturnValue
Var withoutProxy
Var withProxy
Var haveProxyInfo
Var ProxyHost
Var ProxyPort
Var ProxyUser
Var ProxyPass
Var RegInep
Var InepPointer
;Installer init function
Function .onInit
;Prevent the user from run multiple instances of this installer
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Instalador \
ProInfoData") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "Uma instância do instalador já \
está em execução."
Abort
;Kill proinfodataAgent.exe process
KillProcDLL::KillProc "proinfodataAgent.exe"
;Verify if INEP exists in Windows registry
ClearErrors
ReadRegStr $R2 HKLM "SOFTWARE\${PRODUCT_NAME}" "INEP"
${If} ${Errors}
StrCpy $RegInep "false"
${EndIf}
FunctionEnd
;Generates a page asking for proxy information
Function PROXY_1
StrCmp $RegInep "false" 0 NoExecFuncProxy_1
nsDialogs::Create 1018
Pop $Dialog
${if} $Dialog == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Informações de Proxy" "Antes de prosseguir, \
responda a questão abaixo"
${NSD_CreateLabel} 0 0 100% 12u "Você possui informações de proxy?"
Pop $R2
${NSD_CreateRadioButton} 0 9% 40% 6% "Não"
Pop $withoutProxy
${NSD_CreateRadioButton} 0 18% 40% 6% "Sim"
Pop $withProxy
;Set the "Não" radio button as default
${NSD_AddStyle} $withoutProxy ${WS_GROUP}
${NSD_SetState} $withoutProxy 1
nsDialogs::Show
NoExecFuncProxy_1:
FunctionEnd
;This function is executed when the user leaves PROXY_1 page. In this function,
;the haveProxyInfo variable is set based on user answer about proxy
;information
Function proxyLeave
${NSD_GetState} $withProxy $R0
${NSD_GetState} $withoutProxy $R1
${If} $R0 = 1
StrCpy $haveProxyInfo 1
${ElseIf} $R1 = 1
StrCpy $haveProxyInfo 0
${EndIf}
FunctionEnd
;Generates a page with a form about proxy information
Function PROXY_2
StrCmp $RegInep "false" 0 NoExecFuncProxy_2
;If the user does not have proxy information, this page is aborted
${if} $haveProxyInfo = 0
Abort
${endif}
nsDialogs::Create 1018
Pop $Dialog
${if} $Dialog == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Informações de Proxy" "Antes de prosseguir, \
digite as informações de proxy"
${NSD_CreateLabel} 0 0 100% 12u "Proxy host:"
Pop $R2
${NSD_CreateLabel} 0 20% 100% 12u "Proxy port:"
Pop $R2
${NSD_CreateLabel} 0 40% 100% 12u "Proxy user:"
Pop $R2
${NSD_CreateLabel} 0 60% 100% 12u "Proxy password:"
Pop $R2
${NSD_CreateText} 0 13u 100% 12u ""
Pop $R4
${NSD_CreateText} 0 30% 100% 12u ""
Pop $R5
${NSD_CreateText} 0 50% 100% 12u ""
Pop $R6
${NSD_CreateText} 0 70% 100% 12u ""
Pop $R7
nsDialogs::Show
NoExecFuncProxy_2:
FunctionEnd
;This function get the proxy information typed by the user in PROXY_2 page
Function proxyInfo
${NSD_GetText} $R4 $ProxyHost
${NSD_GetText} $R5 $ProxyPort
${NSD_GetText} $R6 $ProxyUser
${NSD_GetText} $R7 $ProxyPass
FunctionEnd
;Generates inep input page
Function INEP
StrCmp $RegInep "false" 0 NoExecFuncInep
nsDialogs::Create 1018
Pop $Dialog
${if} $Dialog == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Validação INEP" "Antes de prosseguir tenha \
certeza de que possui um INEP válido."
;Disables the 'next' or 'install" button
GetDlgItem $R3 $HWNDPARENT 1
EnableWindow $R3 0
${NSD_CreateLabel} 0 0 100% 12u "Digite o INEP da instituição"
Pop $R2
${NSD_CreateText} 0 13u 100% 12u ""
Pop $InepPointer
;Check onClick event on "Validar" button
${NSD_CreateButton} 255u 40u 15% 12u "Validar"
Pop $R2
${NSD_OnClick} $R2 validate
nsDialogs::Show
NoExecFuncInep:
FunctionEnd
;This function validates school INEP
Function validate
Pop $R2
SetOutPath "$TEMP"
File "..\bin\getSchoolInfo.exe"
${NSD_GetText} $InepPointer $Inep
${if} $haveProxyInfo = 0
nsExec::Exec "$TEMP\getSchoolInfo.exe http://seed.c3sl.ufpr.br:8888/\
axis/services/Seed2InstallService $Inep"
Pop $ReturnValue
${else}
nsExec::Exec "$TEMP\getSchoolInfo.exe http://seed.c3sl.ufpr.br:8888/\
axis/services/Seed2InstallService $Inep $ProxyHost $ProxyPort \
$ProxyUser $ProxyPass"
Pop $ReturnValue
${endif}
${If} $ReturnValue == 0
MessageBox MB_OK "Seu INEP foi verificado e está em nossa base de \
dados"
EnableWindow $R3 1
${ElseIf} $ReturnValue == 1
MessageBox MB_OK "ERRO: Parâmetros incorretos"
${ElseIf} $ReturnValue == 2
MessageBox MB_OK "ERRO: Problemas ao conectar ao servidor"
${Else}
MessageBox MB_OK "ERRO: INEP inválido"
${EndIf}
FunctionEnd
;Main installer section
Section "SeçãoPrincipal" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
;Verify INEP in Windows registry. If not exists, creates a new one.
ClearErrors
ReadRegStr $R2 HKLM "SOFTWARE\${PRODUCT_NAME}" "INEP"
${If} ${Errors}
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "INEP" $Inep
${EndIf}
;Add ProinfodataAgent task in Windows task scheduler
nsExec::Exec "schtasks /Create /SC HOURLY /MO 1 /TN ProinfodataAgent \
/TR $\"\$\"${PRODUCT_TASK}$\"\$\" /RU System /F"
Pop $R2
File "..\COPYING"
CreateDirectory "$INSTDIR\conf"
CreateDirectory "$INSTDIR\data"
CreateDirectory "$INSTDIR\log"
CreateDirectory "$INSTDIR\update"
CreateDirectory "$INSTDIR\..\data"
SetOutPath "$INSTDIR\bin"
File "..\bin\client.exe"
SetOutPath "$INSTDIR\bin\agent"
File "..\..\windows-coleta\src\dist\API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
File "..\..\windows-coleta\src\dist\API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
File "..\..\windows-coleta\src\dist\API-MS-Win-Security-Base-L1-1-0.dll"
File "..\..\windows-coleta\src\dist\bz2.pyd"
File "..\..\windows-coleta\src\dist\KERNELBASE.dll"
File "..\..\windows-coleta\src\dist\library.zip"
File "..\..\windows-coleta\src\dist\POWRPROF.dll"
File "..\..\windows-coleta\src\dist\proinfodataAgent.exe"
File "..\..\windows-coleta\src\dist\pyexpat.pyd"
File "..\..\windows-coleta\src\dist\python27.dll"
File "..\..\windows-coleta\src\dist\pythoncom27.dll"
File "..\..\windows-coleta\src\dist\pywintypes27.dll"
File "..\..\windows-coleta\src\dist\select.pyd"
File "..\..\windows-coleta\src\dist\unicodedata.pyd"
File "..\..\windows-coleta\src\dist\w9xpopen.exe"
File "..\..\windows-coleta\src\dist\win32api.pyd"
File "..\..\windows-coleta\src\dist\win32ui.pyd"
File "..\..\windows-coleta\src\dist\_ctypes.pyd"
File "..\..\windows-coleta\src\dist\_hashlib.pyd"
File "..\..\windows-coleta\src\dist\_socket.pyd"
File "..\..\windows-coleta\src\dist\_ssl.pyd"
File "..\..\windows-coleta\src\dist\_win32sysloader.pyd"
WriteRegStr HKLM "SOFTWARE\${PRODUCT_NAME}" "Version" ${PRODUCT_VERSION}
;Execute Proinfodata Agent
nsExec::Exec "schtasks /Run /TN ProinfodataAgent"
SectionEnd
;Uninstaller creation
Section -Post
WriteUninstaller "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"UninstallString" "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
;Uninstaller init function
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Tem certeza que quer \
remover completamente $(^Name) e todos os seus componentes?" IDYES +2
Abort
FunctionEnd
;Shows a messagebox if the uninstall process is succeeded
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) foi removido com sucesso \
do seu computador."
FunctionEnd
;Remove proinfodata files
Section Uninstall
Delete "$INSTDIR\${PRODUCT_UNINST_NAME}.exe"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\bin\client.exe"
Delete "$INSTDIR\bin\agent\API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\API-MS-Win-Security-Base-L1-1-0.dll"
Delete "$INSTDIR\bin\agent\bz2.pyd"
Delete "$INSTDIR\bin\agent\KERNELBASE.dll"
Delete "$INSTDIR\bin\agent\library.zip"
Delete "$INSTDIR\bin\agent\POWRPROF.dll"
Delete "$INSTDIR\bin\agent\proinfodataAgent.exe"
Delete "$INSTDIR\bin\agent\pyexpat.pyd"
Delete "$INSTDIR\bin\agent\python27.dll"
Delete "$INSTDIR\bin\agent\pythoncom27.dll"
Delete "$INSTDIR\bin\agent\pywintypes27.dll"
Delete "$INSTDIR\bin\agent\select.pyd"
Delete "$INSTDIR\bin\agent\unicodedata.pyd"
Delete "$INSTDIR\bin\agent\w9xpopen.exe"
Delete "$INSTDIR\bin\agent\win32api.pyd"
Delete "$INSTDIR\bin\agent\win32ui.pyd"
Delete "$INSTDIR\bin\agent\_ctypes.pyd"
Delete "$INSTDIR\bin\agent\_hashlib.pyd"
Delete "$INSTDIR\bin\agent\_socket.pyd"
Delete "$INSTDIR\bin\agent\_ssl.pyd"
Delete "$INSTDIR\bin\agent\_win32sysloader.pyd"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR\conf"
RMDir "$INSTDIR\data"
RMDir "$INSTDIR\log"
RMDir "$INSTDIR\update"
RMDir "$INSTDIR\..\data"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegValue HKLM "SOTWARE\${PRODUCT_NAME}" "Version"
DeleteRegValue HKLM "SOFTWARE\${PRODUCT_NAME}" "INEP"
DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}"
;Delete scheduled task
nsExec::Exec "schtasks /Delete /TN ProinfodataAgent /F"
Pop $R2
SetAutoClose true
SectionEnd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment