1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
;NSIS Modern User Interface
;Basic Example Script
;--------------------------------
;Include custom settings if exists
!include /NONFATAL "custom.nsh"
;--------------------------------
;Include version information
!include /NONFATAL "generated_scmrev.nsh"
!ifndef SCMREVISION
!define SCMREVISION "2.0.x"
!endif
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
!include "WinVer.nsh"
!define APPNAME "LibreCAD"
!define MUI_ICON "..\..\librecad\res\main\librecad.ico"
!define MUI_UNICON "..\..\librecad\res\main\uninstall.ico"
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
;--------------------------------
;General
;Name and file
Name "${APPNAME}"
OutFile "../../generated/LibreCAD-Installer.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\LibreCAD"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\LibreCAD" ""
;Request application pivileges for Windows Vista
RequestExecutionLevel admin
;TargetMinimalOS 5.1
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "../../gpl-2.0.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
Function .onInit
Push $R0
Push $R1
Push $R2
; get acount info into $R2
userInfo::getAccountType
pop $0
StrCpy $R2 $0 5
${If} ${IsWin2000}
strCmp $R2 "Admin" lbl_checkok
messageBox MB_OK "I am sorry, this installer needs Admin priviledges, Please login as an administrator and install the software."
Quit
${EndIf}
${If} ${IsWinXP}
strCmp $R2 "Admin" lbl_checkok
messageBox MB_OK "I am sorry, this installer needs Admin priviledges, Please login as an administrator and install the software."
Quit
${EndIf}
lbl_checkok:
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
;--- define Qt folders if not already defined in custom-5.3.nsi
!ifndef Qt_Dir
!define Qt_Dir "C:\Qt\Qt5.4.0"
!endif
!ifndef Qt_Version
!define Qt_Version "5.4"
!endif
!ifndef Mingw_Ver
!define Mingw_Ver "mingw491_32"
!endif
;--- folder contains mingw32-make.exe
!define MINGW_DIR "${Qt_Dir}\Tools\${Mingw_Ver}\bin"
!define QTCREATOR_DIR "${Qt_Dir}\Tools\QtCreator\bin"
!define QTMINGW_DIR "${Qt_Dir}\${Qt_Version}\${Mingw_Ver}"
;--- folder contains qmake.exe
!define QMAKE_DIR "${QTMINGW_DIR}\bin"
!define PLUGINS_DIR "${QTMINGW_DIR}\plugins"
!define TRANSLATIONS_DIR "${QTMINGW_DIR}\translations"
;--------------------------------
;Installer Sections
Section "Install Section" SecInstall
SetOutPath "$INSTDIR"
File /r "..\..\windows\*.*"
SetOutPath "$INSTDIR\resources\qm"
File /NONFATAL "${TRANSLATIONS_DIR}\qt*.qm"
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKCU "Software\LibreCAD" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; create shortcuts
createShortCut "$DESKTOP\LibreCAD.lnk" "$INSTDIR\LibreCAD.exe"
; Startmenu shortcuts
createDirectory "$SMPROGRAMS\LibreCAD\"
createShortCut "$SMPROGRAMS\LibreCAD\LibreCAD.lnk" "$INSTDIR\LibreCAD.exe"
createShortCut "$SMPROGRAMS\LibreCAD\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
; create add/remove software entries
WriteRegStr HKLM "${UNINSTKEY}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "${UNINSTKEY}" "DisplayIcon" "$INSTDIR\LibreCAD.exe"
WriteRegStr HKLM "${UNINSTKEY}" "DisplayVersion" "${SCMREVISION}"
WriteRegStr HKLM "${UNINSTKEY}" "Publisher" "LibreCAD Team"
WriteRegStr HKLM "${UNINSTKEY}" "Version" "2.0"
WriteRegStr HKLM "${UNINSTKEY}" "HelpLink" "http://librecad.org/cms/home/get-help/forum.html"
WriteRegStr HKLM "${UNINSTKEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${UNINSTKEY}" "URLInfoAbout" "http://librecad.org/"
WriteRegStr HKLM "${UNINSTKEY}" "Comments" "LibreCAD - Open Source 2D-CAD"
WriteRegStr HKLM "${UNINSTKEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegDWORD HKLM "${UNINSTKEY}" "VersionMinor" "0"
WriteRegDWORD HKLM "${UNINSTKEY}" "VersionMajor" "2"
WriteRegDWORD HKLM "${UNINSTKEY}" "NoModify" "1"
WriteRegDWORD HKLM "${UNINSTKEY}" "NoRepair" "1"
; Open Donate URL
Exec "rundll32 url.dll,FileProtocolHandler http://librecad.org/donate.html"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecInstall ${LANG_ENGLISH} "A test section."
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"
Delete "$DESKTOP\LibreCAD.lnk"
RMDir /r "$SMPROGRAMS\LibreCAD\"
RMDir /r $INSTDIR
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\LibreCAD"
DeleteRegKey HKLM "${UNINSTKEY}"
SectionEnd
|