fix NSIS scripts
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
#http://www.fredshack.com/docs/nsis.html
|
||||
# include the Version information
|
||||
!include Version.nsi
|
||||
!include "MUI2.nsh"
|
||||
!include "Sections.nsh"
|
||||
|
||||
|
||||
# All the other settings can be tweaked by editing the !defines at the top of this script
|
||||
!define APPNAME "FreeCAD"
|
||||
@@ -38,25 +41,33 @@
|
||||
!define INSTALLSIZE 200000
|
||||
|
||||
!define FULLNAME "${APPNAME} ${VERSIONMAJOR}.${VERSIONMINOR}"
|
||||
!define INSTNAME "${APPNAME}-${VERSIONMAJOR}.${VERSIONMINOR}"
|
||||
|
||||
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
|
||||
|
||||
|
||||
InstallDir "$PROGRAMFILES\${FULLNAME}"
|
||||
|
||||
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
|
||||
LicenseData "License.rtf"
|
||||
|
||||
# This will be in the installer/uninstaller's title bar
|
||||
Name "${FULLNAME}"
|
||||
#Icon "logo.ico"
|
||||
outFile "..\..\${FULLNAME}.${VERSIONBUILD}_x86_unstable_setup.exe"
|
||||
|
||||
!include LogicLib.nsh
|
||||
|
||||
# Just three pages - license agreement, install location, and installation
|
||||
page license
|
||||
page directory
|
||||
Page instfiles
|
||||
|
||||
outFile "..\..\${INSTNAME}.${VERSIONBUILD}_x86_unstable_setup.exe"
|
||||
|
||||
#Interface Settings
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
#Pages
|
||||
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
|
||||
!insertmacro MUI_PAGE_LICENSE "License.rtf"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
#Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
!macro VerifyUserIsAdmin
|
||||
UserInfo::GetAccountType
|
||||
pop $0
|
||||
@@ -66,18 +77,21 @@ ${If} $0 != "admin" ;Require admin rights on NT4+
|
||||
quit
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
|
||||
function .onInit
|
||||
setShellVarContext all
|
||||
!insertmacro VerifyUserIsAdmin
|
||||
Call unSelectInstallOptions
|
||||
functionEnd
|
||||
|
||||
section "install"
|
||||
section "FreeCAD (Required)"
|
||||
SectionIn RO
|
||||
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
|
||||
setOutPath $INSTDIR\bin
|
||||
# Files added here should be removed by the uninstaller (see section "uninstall")
|
||||
file /r /X *.idb /X *.pyc /X *.pyo "..\..\bin\"
|
||||
setOutPath $INSTDIR\lib
|
||||
file /r /X *.lib /X *.pyc /X *.pyo "..\..\lib\"
|
||||
setOutPath $INSTDIR\Mod
|
||||
file /r /X *.idb "..\..\Mod\"
|
||||
setOutPath $INSTDIR\doc
|
||||
@@ -88,20 +102,21 @@ section "install"
|
||||
file /r "..\..\Ext\"
|
||||
setOutPath $INSTDIR
|
||||
file "vcredist_x86.exe"
|
||||
|
||||
|
||||
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
||||
writeUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
# Start Menu
|
||||
createDirectory "$SMPROGRAMS\${FULLNAME}"
|
||||
createShortCut "$SMPROGRAMS\${FULLNAME}\${APPNAME}.lnk" "$INSTDIR\bin\FreeCAD.exe" "" ""
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\${FULLNAME}"
|
||||
CreateShortCut "$SMPROGRAMS\${FULLNAME}\${APPNAME}.lnk" "$INSTDIR\bin\FreeCAD.exe" "" ""
|
||||
CreateShortCut "$SMPROGRAMS\${FULLNAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" ""
|
||||
|
||||
# Registry information for add/remove programs
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "DisplayName" "${FULLNAME} - ${DESCRIPTION}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "DisplayIcon" "$\"$INSTDIR\bin\FreeCAD.exe$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "Publisher" "${PUPNAME}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "HelpLink" "$\"${HELPURL}$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
|
||||
@@ -114,8 +129,11 @@ section "install"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "NoRepair" 1
|
||||
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}" "EstimatedSize" ${INSTALLSIZE}
|
||||
sectionEnd
|
||||
|
||||
section "Add to PYTHONPATH" PythonPathSection
|
||||
# Set PYTHONPATH for FreeCAD
|
||||
#WriteRegStr HKLM "Software\Python\PythonCore\2.7\PythonPath\${FULLNAME}" "" "$INSTDIR\bin"
|
||||
WriteRegStr HKLM "Software\Python\PythonCore\2.7\PythonPath\${FULLNAME}" "" "$INSTDIR\bin"
|
||||
sectionEnd
|
||||
|
||||
section "Install redistributable" VCRedistSection
|
||||
@@ -125,46 +143,55 @@ sectionEnd
|
||||
|
||||
# http://forums.winamp.com/showthread.php?t=255747
|
||||
function unSelectInstallOptions
|
||||
# Deselect the PYTHONPATH option
|
||||
!insertmacro UnselectSection ${PythonPathSection}
|
||||
!insertmacro UnselectSection ${VCRedistSection}
|
||||
functionEnd
|
||||
|
||||
LangString DESC_PythonPathSection ${LANG_ENGLISH} "Add the FreeCAD installation directory to PYTHONPATH in the registry."
|
||||
LangString DESC_VCRedistSection ${LANG_ENGLISH} "Install the Visual Studio redistributable."
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${PythonPathSection} $(DESC_PythonPathSection)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${VCRedistSection} $(DESC_VCRedistSection)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
|
||||
# Uninstaller
|
||||
|
||||
|
||||
function un.onInit
|
||||
SetShellVarContext all
|
||||
|
||||
|
||||
#Verify the uninstaller - last chance to back out
|
||||
MessageBox MB_OKCANCEL "Permanently remove ${APPNAME}?" /SD IDOK IDOK next
|
||||
Abort
|
||||
next:
|
||||
!insertmacro VerifyUserIsAdmin
|
||||
functionEnd
|
||||
|
||||
section "uninstall"
|
||||
|
||||
|
||||
section "Uninstall"
|
||||
|
||||
# Remove Start Menu launcher
|
||||
delete "$SMPROGRAMS\${FULLNAME}\${APPNAME}.lnk"
|
||||
Delete "$SMPROGRAMS\${FULLNAME}\${APPNAME}.lnk"
|
||||
Delete "$SMPROGRAMS\${FULLNAME}\Uninstall.lnk"
|
||||
# Try to remove the Start Menu folder - this will only happen if it is empty
|
||||
rmDir "$SMPROGRAMS\${FULLNAME}"
|
||||
|
||||
RMDir "$SMPROGRAMS\${FULLNAME}"
|
||||
|
||||
# Remove files
|
||||
rmDir /r "$INSTDIR\bin"
|
||||
rmDir /r "$INSTDIR\doc"
|
||||
rmDir /r "$INSTDIR\data"
|
||||
rmDir /r "$INSTDIR\Mod"
|
||||
|
||||
RMDir /r "$INSTDIR\bin"
|
||||
RMDir /r "$INSTDIR\lib"
|
||||
RMDir /r "$INSTDIR\doc"
|
||||
RMDir /r "$INSTDIR\data"
|
||||
RMDir /r "$INSTDIR\Ext"
|
||||
RMDir /r "$INSTDIR\Mod"
|
||||
|
||||
# Always delete uninstaller as the last action
|
||||
delete $INSTDIR\uninstall.exe
|
||||
# Try to remove the install directory - this will only happen if it is empty
|
||||
rmDir $INSTDIR
|
||||
|
||||
Delete $INSTDIR\uninstall.exe
|
||||
Delete $INSTDIR\vcredist_x86.exe
|
||||
# Try to remove the install directory - this will only happen if it is empty
|
||||
RMDir $INSTDIR
|
||||
|
||||
# Remove uninstaller information from the registry
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FULLNAME}"
|
||||
DeleteRegKey HKLM "Software\Python\PythonCore\2.7\PythonPath\${FULLNAME}"
|
||||
sectionEnd
|
||||
|
||||
@@ -135,6 +135,9 @@ section "FreeCAD (Required)"
|
||||
sectionEnd
|
||||
|
||||
section "Add to PYTHONPATH" PythonPathSection
|
||||
# Access the right location for 64-bit applications
|
||||
SetRegView 64
|
||||
|
||||
# Set PYTHONPATH for FreeCAD
|
||||
WriteRegStr HKLM "Software\Python\PythonCore\2.7\PythonPath\${FULLNAME}" "" "$INSTDIR\bin"
|
||||
sectionEnd
|
||||
@@ -185,6 +188,7 @@ section "Uninstall"
|
||||
RMDir /r "$INSTDIR\lib"
|
||||
RMDir /r "$INSTDIR\doc"
|
||||
RMDir /r "$INSTDIR\data"
|
||||
RMDir /r "$INSTDIR\Ext"
|
||||
RMDir /r "$INSTDIR\Mod"
|
||||
|
||||
# Always delete uninstaller as the last action
|
||||
|
||||
Reference in New Issue
Block a user