Roolnet Start futtatókörnyezet telepítő szkript

A RoolWikiBÓL

Revision as of 2009. január 21., 09:36 by Rozsahegyil (Vita | szerkesztései)
(eltér) ←Régebbi változat | legfrissebb változat (eltér) | Újabb változat→ (eltér)
!include nsDialogs.nsh
!include LogicLib.nsh
# hostname paraméterhet
Var Dialog
Var hostLabel
Var hostText
Var hostText_State
Var hostImage
Var hostImageHandle
# end of hostname paraméterhet
Var uninstallerName 
setCompressor /SOLID lzma

!define prodVersion "v1.98.116"
!define setup "roolnetStart_${prodVersion}.exe"

; change this to wherever the files to be packaged reside
!define srcdir "."

!define company "ROOL"

!define prodname "roolnet Start ${prodVersion}"
!define exec "vrt.exe"
!define execparam "driver=QPSQL7 host=$hostText_State app=app user=admin password=admin1"

; optional stuff
 
; text file to open in notepad after installation
; !define notefile "README.txt"

# license text file
!define licensefile roolnetStart_licensz_hu.txt

; icons must be Microsoft .ICO files
; !define icon "icon.ico"

; installer background screen
; !define screenimage background.bmp 

; file containing list of file-installation commands
; !define files "files.nsi"
 
; file containing list of file-uninstall commands
; !define unfiles "unfiles.nsi"
 
!define website "roolnet.hu"

; registry stuff
!define regkey "Software\${company}\${prodname}"
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
 
!define startmenu "$SMPROGRAMS\${company}\${prodname}"
!define uninstaller "uninstall.exe"

;--------------------------------
XPStyle on
ShowInstDetails hide
ShowUninstDetails hide

; The name of the installer
Name "${prodname}"
Caption "${prodname}"

!ifdef icon
Icon "${icon}"
!endif

; The file to write by  compiler
OutFile "${setup}"

SetDateSave on
SetDatablockOptimize on
CRCCheck on
SilentInstall normal

; The default installation directory
InstallDir "$PROGRAMFILES\${company}\${prodname}"
InstallDirRegKey HKLM "${regkey}" ""
; Request application privileges for Windows Vista
RequestExecutionLevel admin
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Hungarian.nlf"
!ifdef licensefile
LicenseData "${srcdir}\${licensefile}"
!endif
; pages
; we keep it simple - leave out selectable installation types

!ifdef licensefile
Page license
!endif

;Page components
Page custom nsDialogsPage_hostParam nsDialogsPageLeave_hostParam
Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles
AutoCloseWindow false
ShowInstDetails show
 ; The stuff to install
Section "" ;No components page, name is not important

 WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
 ; write uninstall strings
 WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove only)"
 WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'

 !ifdef filetype
  WriteRegStr HKCR "${filetype}" "" "${prodname}"
 !endif

 WriteRegStr HKCR "${prodname}\Shell\open\command\" "" '"$INSTDIR\${exec} "%1"'

 !ifdef icon
  WriteRegStr HKCR "${prodname}\DefaultIcon" "" "$INSTDIR\${icon}"
 !endif

 ; Set output path to the installation directory.
 SetOutPath $INSTDIR
 
 ; Put file there
 File vrt.exe
 File vrtsblib.dll
 File libpq.dll
 File qsqlpsql.dll
 File qt-mt331.dll
 File odbc.dll
 File lpsolve55.dll
 File vrtlibdevice.dll
 File vrtlibglp58hw.dll
 File vrtlibglp58mcs.dll
 File vrtlibite.dll
 File vrtlibserial.dll
 File vrtlibsocket.dll
 File vrtlibstmcs.dll

 ; descktop ikon létrehozása
 CreateShortCut "$INSTDIR\${prodname}.lnk" \
 "$INSTDIR\vrt.exe" \
 "${execparam}" \
 "$INSTDIR\vrt.exe" 0 \
 SW_SHOWNORMAL \
 ALT|CONTROL|SHIFT|F5 \
 "roolnet futtatókörnyezet"
 
 #start menüben elhelyezés
 CreateDirectory "${startmenu}"
 CopyFiles "$INSTDIR\${prodname}.lnk" "${startmenu}\${prodname}.lnk"
 CopyFiles "$INSTDIR\${prodname}.lnk" "$DESKTOP\${prodname}.lnk"

 #uninstaller
 writeUninstaller $INSTDIR\$uninstallerName

 CreateShortCut "${startmenu}\roolnet Start Eltávolítás.lnk" "$INSTDIR\$uninstallerName"

 !ifdef website
 WriteINIStr "${startmenu}\roolnet Start Honlap.url" "InternetShortcut" "URL" ${website}
 WriteINIStr "${startmenu}\roolnet Start Dokumentáció.url" "InternetShortcut" "URL" "www.elelmiszerbiztonsag.hu/mediawiki"
 ; CreateShortCut "${startmenu}\Web Site.lnk "${website}" "URL"
 !endif

SectionEnd ; end the section
; Uninstaller
; All section names prefixed by "Un" will be in the uninstaller

UninstallText "${prodname} eltávolítása."

!ifdef icon
UninstallIcon "${icon}"
!endif

Section "Uninstall"
 
 DeleteRegKey HKLM "${uninstkey}"
 DeleteRegKey HKLM "${regkey}"

 RMDir /r "$SMPROGRAMS\${company}"

 delete $INSTDIR\uninstaller.exe

 delete "$SMPROGRAMS\roolnet Start"
 
 delete $INSTDIR\vrt.exe
 delete $INSTDIR\vrtsblib.dll
 delete $INSTDIR\libpq.dll
 delete $INSTDIR\qsqlpsql.dll
 delete $INSTDIR\qt-mt331.dll
 delete $INSTDIR\odbc.dll
 delete $INSTDIR\lpsolve55.dll
 delete $INSTDIR\vrtlibdevice.dll
 delete $INSTDIR\vrtlibglp58hw.dll
 delete $INSTDIR\vrtlibglp58mcs.dll
 delete $INSTDIR\vrtlibite.dll
 delete $INSTDIR\vrtlibserial.dll
 delete $INSTDIR\vrtlibsocket.dll
 delete $INSTDIR\vrtlibstmcs.dll
 
 delete "$INSTDIR\${prodname}.lnk"

 RMDir $INSTDIR
 RMDir "$PROGRAMFILES\${company}"

 delete "$DESKTOP\${prodname}.lnk"
 
SectionEnd ; end the section Uninstall
Function .onInit
 # Prevent Multiple Instances
 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "roolnetMutex") i .r1 ?e'
 Pop $R0

 StrCmp $R0 0 +3
  MessageBox MB_OK|MB_ICONEXCLAMATION "A telepítő már fut egy példányban."
  Abort
 # end of Prevent Multiple Instances

 # kezdőkép megjelenítése   
 SetOutPath $TEMP
 File /oname=spltmp.bmp roolnet_splash.bmp
 ; optional
 ; File /oname=spltmp.wav "my_splashshit.wav"

 advsplash::show 1000 600 400 -1 $TEMP\spltmp

 Pop $0 ; $0 has '1' if the user closed the splash screen early,
        ; '0' if everything closed normally, and '-1' if some error occurred.
 Delete $TEMP\spltmp.bmp
;  Delete $TEMP\spltmp.wav
# end of kezdőkép megjelenítése   

 File /oname=$PLUGINSDIR\hostimage.bmp "roolnet_splash2.bmp"
 StrCpy $hostText_State "Localhost"
 StrCpy $uninstallerName "uninstaller.exe"
FunctionEnd
# host bekérése, a parancsikon készítéséhez
Function nsDialogsPage_hostParam

 nsDialogs::Create 1018
 Pop $Dialog

 ${If} $Dialog == error
   Abort
 ${EndIf}
 
 ${NSD_CreateLabel} 0 70u 100% 12u "Kérem adja meg a roolnet adatbázist szolgáltató gép nevét (vagy IP címét)!"
 Pop $hostLabel

 ${NSD_CreateText} 0 83u 100% 13u $hostText_State
 Pop $hostText

 ${NSD_CreateBitmap} 0 0 100% 100% ""
  Pop $hostImage
 ${NSD_SetImage} $hostImage $PLUGINSDIR\hostimage.bmp $hostImageHandle

 nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave_hostParam
 ${NSD_GetText} $hostText $hostText_State
FunctionEnd
Személyes eszközök