# Script generated by the HM NIS Edit Script Wizard.
# HM NIS Edit Wizard helper defines
!define PRODUCT_GROUP "Fiber Mountain"
!define PRODUCT_NAME "Aos"
!define PRODUCT_VERSION "VERSIONSTRING"
!define PRODUCT_PUBLISHER "Fiber Mountain Inc."
!define PRODUCT_WEB_SITE "http://www.fibermountain.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\${PRODUCT_GROUP}\${PRODUCT_NAME}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_GROUP}\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define STARTMENUBASE "${PRODUCT_GROUP}\${PRODUCT_NAME}"
Var Desktopshortcut
Var Quicklaunchshortcut
#Var dsktopState
# MUI 1.67 compatible ------
!include "InstallOptions.nsh"
!include "MUI2.nsh"
!include "x64.nsh"
#installer attribute, remove version string
BrandingText " "
# MUI Settings ------
!define MUI_ABORTWARNING
# set logos
!define MUI_ICON "assets\logo.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
# set default section description empty
!define MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO " "
# finish run link settings, This define value does not make any different but the define needs to be there for the page to show.
!define MUI_FINISHPAGE_RUN "Blah"
# set welcome page picture, commended size: 164x314 pixels
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\datacenter.bmp"
#Set intallment pages
# Welcome page
!insertmacro MUI_PAGE_WELCOME
# License page
#!define MUI_LICENSEPAGE_CHECKBOX
#!insertmacro MUI_PAGE_LICENSE "Install\license.rtf"
# Check whether componenets have been selected
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE MustChooseComponents
# Components page
!insertmacro MUI_PAGE_COMPONENTS
# Directory page
Page Directory "" "" DirLeave
# Instfiles page
Page InstFiles
# Shortcut page, this is custom page
Page custom SetShortcut
# This is for the option to launch the application at the end of the installation.
#!define MUI_FINISHPAGE_RUN_TEXT "Add shortcut to Start Menu"
!define MUI_FINISHPAGE_RUN_FUNCTION "RunApp"
!insertmacro MUI_PAGE_FINISH
# Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
# Language files
!insertmacro MUI_LANGUAGE "English"
# MUI end ------
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
# specify installment directory and output file name
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "OUTPUTFILE.exe"
; This line fixed the problem with removing desktop shortcuts.
; The level must be NONE for the shortcuts to be created!!!
;RequestExecutionLevel none
;when create a start menu directory for shortcuts, the executionLevel could be admin
RequestExecutionLevel admin
InstallDir "$PROGRAMFILES\${PRODUCT_GROUP}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function DirLeave
${If} ${FileExists} "$InstDir\*"
MessageBox MB_YESNO `"$InstDir" already exists, delete it's content and continue installing?` IDYES yep
Abort
yep:
${If} ${FileExists} "$PROGRAMFILES\FMBackup\*.*"
${Else}
CreateDirectory "$PROGRAMFILES\FMBackup"
${EndIf}
CopyFiles "$INSTDIR\${PRODUCT_NAME}\Exported Files\*.*" "$PROGRAMFILES\FMBackup"
RMDir /r $INSTDIR
CreateDirectory "$INSTDIR\${PRODUCT_NAME}\Exported Files"
CopyFiles "$PROGRAMFILES\FMBackup\*.*" "$INSTDIR\${PRODUCT_NAME}\Exported Files"
RMDir /r "$PROGRAMFILES\FMBackup"
${EndIf}
FunctionEnd
# components to be installed
Section "Jre_64 bits" INSTALLJRE64
SectionIn RO
SetOutPath "$INSTDIR\${PRODUCT_NAME}\JRE"
SetOverwrite ifnewer
File /r "Install\JREs\64Bits\windows\"
SectionEnd
Section "Core" INSTALLCORE
SectionIn RO
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File /r /x fimoServer /x dist /x Readme.txt /x Aos.exe /x Aos.jar /x Initializer.exe /x Planner.exe /x PlannerStandalone.exe /x AosStandalone.exe /x Server.exe "Install\${PRODUCT_NAME}\" "assets\logo.ico"
SectionEnd
Section "Server" INSTALLSERVER
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File "Install\${PRODUCT_NAME}\Server.exe"
;check "run as admin" checkbox of .exe files
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "RUNASADMIN"
SectionEnd
Section "Aos Client" INSTALLAOS
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File "Install\${PRODUCT_NAME}\Aos.exe" "Install\${PRODUCT_NAME}\AosStandalone.exe"
;check "run as admin" checkbox of .exe files
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "RUNASADMIN"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "RUNASADMIN"
SectionEnd
;Section "Planner Client" INSTALLPLANNER
; SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
; SetOverwrite ifnewer
; File "Install\${PRODUCT_NAME}\Planner.exe" "Aos Manager\PlannerStandalone.exe"
;SectionEnd
;Section "Initializer Client" INSTALLINITIALIZER
; SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
; SetOverwrite ifnewer
; File "Install\${PRODUCT_NAME}\Initializer.exe"
;SectionEnd
#----------------------
# read in custom page setting file .ini
Function .onInit
!insertmacro INSTALLOPTIONS_EXTRACT_AS "assets\shortcutoptions.ini" "shortcutoptions.ini"
;if system is 64 bit, change default directory
${If} ${RunningX64}
SetRegView 64
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_GROUP}"
${ENDIf}
setShellVarContext all
!insertmacro VerifyUserIsAdmin
FunctionEnd
# configure elements on "SetShortcut" custom page
Function SetShortcut
!insertmacro MUI_HEADER_TEXT "Additional Shortcut Options" ""
!insertmacro INSTALLOPTIONS_DISPLAY "shortcutoptions.ini"
!insertmacro INSTALLOPTIONS_READ $Desktopshortcut "shortcutoptions.ini" "Field 1" "State"
!insertmacro INSTALLOPTIONS_READ $Quicklaunchshortcut "shortcutoptions.ini" "Field 2" "State"
Call CreateShortcuts
FunctionEnd
Function MustChooseComponents
#if section is selected, $1 = 1, otherwise $1 = 0
SectionGetFlags ${INSTALLSERVER} $1
SectionGetFlags ${INSTALLAOS} $2
IntOp $0 $1 || $2
${If} $0 == 0
MessageBox MB_OK|MB_ICONSTOP 'Please choose at least one component to install.'
Abort
${EndIf}
FunctionEnd
# when finish page is shown, trigger this function
Function CreateShortcuts
SetShellVarContext all
createDirectory "$SMPROGRAMS\${STARTMENUBASE}"
${If} ${SectionIsSelected} ${INSTALLSERVER}
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
#recommend shortcut icon size is 48 * 48 for 32 bit colors
${If} $Desktopshortcut == 1
CreateShortCut "$DESKTOP\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${If} $Quicklaunchshortcut == 1
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${EndIf}
${If} ${SectionIsSelected} ${INSTALLAOS}
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${If} $Desktopshortcut == 1
CreateShortCut "$DESKTOP\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
; CreateShortCut "$DESKTOP\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${If} $Quicklaunchshortcut == 1
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe"
${EndIf}
${EndIf}
; ${If} ${SectionIsSelected} ${INSTALLPLANNER}
; ${If} $Desktopshortcut == 1
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\PlannerClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Planner.exe"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\PlannerStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\PlannerStandalone.exe"
; ${EndIf}
; ${EndIf}
; ${If} ${SectionIsSelected} ${INSTALLINITIALIZER}
; ${If} $Desktopshortcut == 1
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Initializer.lnk" "$INSTDIR\${PRODUCT_NAME}\Initializer.exe"
; ${EndIf}
; ${EndIf}
FunctionEnd
Function RunApp
${If} ${SectionIsSelected} ${INSTALLAOS}
ExecShell "" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"
${EndIf}
FunctionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
createDirectory "$SMPROGRAMS\${STARTMENUBASE}"
CreateShortCut "$SMPROGRAMS\${STARTMENUBASE}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}\Website.url"
CreateShortCut "$SMPROGRAMS\${STARTMENUBASE}\Uninstall.lnk" "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Aos.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
; WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"aaaaaaaa
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}"
;create registry keys for uninstaller in programs and features in control panel
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString" "$\"$INSTDIR\${PRODUCT_NAME}\uninst.exe$\""
SectionEnd
# Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLJRE64} "Java Runtime Environment 64 bits"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLCORE} "${PRODUCT_NAME} core files"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLSERVER} "${PRODUCT_NAME} server files"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLAOS} "${PRODUCT_NAME} client files"
; !insertmacro MUI_DESCRIPTION_TEXT ${INSTALLPLANNER} "${PRODUCT_NAME} planner files"
; !insertmacro MUI_DESCRIPTION_TEXT ${INSTALLINITIALIZER} "${PRODUCT_NAME} initializer files"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
SetShellVarContext all
;RMDir /r $INSTDIR
${If} ${FileExists} "$PROGRAMFILES\FMBackup\*.*"
${Else}
CreateDirectory "$PROGRAMFILES\FMBackup"
${EndIf}
CopyFiles "$INSTDIR\Exported Files\*.*" "$PROGRAMFILES\FMBackup"
RMDir /r $INSTDIR
CreateDirectory "$INSTDIR\Exported Files"
CopyFiles "$PROGRAMFILES\FMBackup\*.*" "$INSTDIR\Exported Files"
RMDir /r "$PROGRAMFILES\FMBackup"
Delete "$DESKTOP\Initializer.lnk"
Delete "$DESKTOP\PlannerClient.lnk"
Delete "$DESKTOP\PlannerStandalone.lnk"
Delete "$DESKTOP\AosClient.lnk"
; Delete "$DESKTOP\AosStandalone.lnk"
Delete "$DESKTOP\Server.lnk"
RMDir /r "$SMPROGRAMS\${PRODUCT_GROUP}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
;remove registry keys for uninstaller in programs and features in control panel
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
SetAutoClose true
SectionEnd
# HM NIS Edit Wizard helper defines
!define PRODUCT_GROUP "Fiber Mountain"
!define PRODUCT_NAME "Aos"
!define PRODUCT_VERSION "VERSIONSTRING"
!define PRODUCT_PUBLISHER "Fiber Mountain Inc."
!define PRODUCT_WEB_SITE "http://www.fibermountain.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\${PRODUCT_GROUP}\${PRODUCT_NAME}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_GROUP}\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define STARTMENUBASE "${PRODUCT_GROUP}\${PRODUCT_NAME}"
Var Desktopshortcut
Var Quicklaunchshortcut
#Var dsktopState
# MUI 1.67 compatible ------
!include "InstallOptions.nsh"
!include "MUI2.nsh"
!include "x64.nsh"
#installer attribute, remove version string
BrandingText " "
# MUI Settings ------
!define MUI_ABORTWARNING
# set logos
!define MUI_ICON "assets\logo.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
# set default section description empty
!define MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO " "
# finish run link settings, This define value does not make any different but the define needs to be there for the page to show.
!define MUI_FINISHPAGE_RUN "Blah"
# set welcome page picture, commended size: 164x314 pixels
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\datacenter.bmp"
#Set intallment pages
# Welcome page
!insertmacro MUI_PAGE_WELCOME
# License page
#!define MUI_LICENSEPAGE_CHECKBOX
#!insertmacro MUI_PAGE_LICENSE "Install\license.rtf"
# Check whether componenets have been selected
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE MustChooseComponents
# Components page
!insertmacro MUI_PAGE_COMPONENTS
# Directory page
Page Directory "" "" DirLeave
# Instfiles page
Page InstFiles
# Shortcut page, this is custom page
Page custom SetShortcut
# This is for the option to launch the application at the end of the installation.
#!define MUI_FINISHPAGE_RUN_TEXT "Add shortcut to Start Menu"
!define MUI_FINISHPAGE_RUN_FUNCTION "RunApp"
!insertmacro MUI_PAGE_FINISH
# Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
# Language files
!insertmacro MUI_LANGUAGE "English"
# MUI end ------
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
# specify installment directory and output file name
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "OUTPUTFILE.exe"
; This line fixed the problem with removing desktop shortcuts.
; The level must be NONE for the shortcuts to be created!!!
;RequestExecutionLevel none
;when create a start menu directory for shortcuts, the executionLevel could be admin
RequestExecutionLevel admin
InstallDir "$PROGRAMFILES\${PRODUCT_GROUP}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function DirLeave
${If} ${FileExists} "$InstDir\*"
MessageBox MB_YESNO `"$InstDir" already exists, delete it's content and continue installing?` IDYES yep
Abort
yep:
${If} ${FileExists} "$PROGRAMFILES\FMBackup\*.*"
${Else}
CreateDirectory "$PROGRAMFILES\FMBackup"
${EndIf}
CopyFiles "$INSTDIR\${PRODUCT_NAME}\Exported Files\*.*" "$PROGRAMFILES\FMBackup"
RMDir /r $INSTDIR
CreateDirectory "$INSTDIR\${PRODUCT_NAME}\Exported Files"
CopyFiles "$PROGRAMFILES\FMBackup\*.*" "$INSTDIR\${PRODUCT_NAME}\Exported Files"
RMDir /r "$PROGRAMFILES\FMBackup"
${EndIf}
FunctionEnd
# components to be installed
Section "Jre_64 bits" INSTALLJRE64
SectionIn RO
SetOutPath "$INSTDIR\${PRODUCT_NAME}\JRE"
SetOverwrite ifnewer
File /r "Install\JREs\64Bits\windows\"
SectionEnd
Section "Core" INSTALLCORE
SectionIn RO
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File /r /x fimoServer /x dist /x Readme.txt /x Aos.exe /x Aos.jar /x Initializer.exe /x Planner.exe /x PlannerStandalone.exe /x AosStandalone.exe /x Server.exe "Install\${PRODUCT_NAME}\" "assets\logo.ico"
SectionEnd
Section "Server" INSTALLSERVER
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File "Install\${PRODUCT_NAME}\Server.exe"
;check "run as admin" checkbox of .exe files
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "RUNASADMIN"
SectionEnd
Section "Aos Client" INSTALLAOS
SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
SetOverwrite ifnewer
File "Install\${PRODUCT_NAME}\Aos.exe" "Install\${PRODUCT_NAME}\AosStandalone.exe"
;check "run as admin" checkbox of .exe files
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "RUNASADMIN"
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "RUNASADMIN"
SectionEnd
;Section "Planner Client" INSTALLPLANNER
; SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
; SetOverwrite ifnewer
; File "Install\${PRODUCT_NAME}\Planner.exe" "Aos Manager\PlannerStandalone.exe"
;SectionEnd
;Section "Initializer Client" INSTALLINITIALIZER
; SetOutPath "$INSTDIR\${PRODUCT_NAME}" #No need to add Aos Manager, the installation already appended it
; SetOverwrite ifnewer
; File "Install\${PRODUCT_NAME}\Initializer.exe"
;SectionEnd
#----------------------
# read in custom page setting file .ini
Function .onInit
!insertmacro INSTALLOPTIONS_EXTRACT_AS "assets\shortcutoptions.ini" "shortcutoptions.ini"
;if system is 64 bit, change default directory
${If} ${RunningX64}
SetRegView 64
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_GROUP}"
${ENDIf}
setShellVarContext all
!insertmacro VerifyUserIsAdmin
FunctionEnd
# configure elements on "SetShortcut" custom page
Function SetShortcut
!insertmacro MUI_HEADER_TEXT "Additional Shortcut Options" ""
!insertmacro INSTALLOPTIONS_DISPLAY "shortcutoptions.ini"
!insertmacro INSTALLOPTIONS_READ $Desktopshortcut "shortcutoptions.ini" "Field 1" "State"
!insertmacro INSTALLOPTIONS_READ $Quicklaunchshortcut "shortcutoptions.ini" "Field 2" "State"
Call CreateShortcuts
FunctionEnd
Function MustChooseComponents
#if section is selected, $1 = 1, otherwise $1 = 0
SectionGetFlags ${INSTALLSERVER} $1
SectionGetFlags ${INSTALLAOS} $2
IntOp $0 $1 || $2
${If} $0 == 0
MessageBox MB_OK|MB_ICONSTOP 'Please choose at least one component to install.'
Abort
${EndIf}
FunctionEnd
# when finish page is shown, trigger this function
Function CreateShortcuts
SetShellVarContext all
createDirectory "$SMPROGRAMS\${STARTMENUBASE}"
${If} ${SectionIsSelected} ${INSTALLSERVER}
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
#recommend shortcut icon size is 48 * 48 for 32 bit colors
${If} $Desktopshortcut == 1
CreateShortCut "$DESKTOP\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${If} $Quicklaunchshortcut == 1
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Server.lnk" "$INSTDIR\${PRODUCT_NAME}\Server.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${EndIf}
${If} ${SectionIsSelected} ${INSTALLAOS}
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${If} $Desktopshortcut == 1
CreateShortCut "$DESKTOP\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
; CreateShortCut "$DESKTOP\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe" "" "$INSTDIR\${PRODUCT_NAME}\logo.ico"
${EndIf}
${If} $Quicklaunchshortcut == 1
CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\AosStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\AosStandalone.exe"
${EndIf}
${EndIf}
; ${If} ${SectionIsSelected} ${INSTALLPLANNER}
; ${If} $Desktopshortcut == 1
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\PlannerClient.lnk" "$INSTDIR\${PRODUCT_NAME}\Planner.exe"
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\PlannerStandalone.lnk" "$INSTDIR\${PRODUCT_NAME}\PlannerStandalone.exe"
; ${EndIf}
; ${EndIf}
; ${If} ${SectionIsSelected} ${INSTALLINITIALIZER}
; ${If} $Desktopshortcut == 1
; CreateShortcut "$SMPROGRAMS\${STARTMENUBASE}\Initializer.lnk" "$INSTDIR\${PRODUCT_NAME}\Initializer.exe"
; ${EndIf}
; ${EndIf}
FunctionEnd
Function RunApp
${If} ${SectionIsSelected} ${INSTALLAOS}
ExecShell "" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"
${EndIf}
FunctionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
createDirectory "$SMPROGRAMS\${STARTMENUBASE}"
CreateShortCut "$SMPROGRAMS\${STARTMENUBASE}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}\Website.url"
CreateShortCut "$SMPROGRAMS\${STARTMENUBASE}\Uninstall.lnk" "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Aos.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${PRODUCT_NAME}\uninst.exe"
; WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}\Aos.exe"aaaaaaaa
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}"
;create registry keys for uninstaller in programs and features in control panel
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString" "$\"$INSTDIR\${PRODUCT_NAME}\uninst.exe$\""
SectionEnd
# Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLJRE64} "Java Runtime Environment 64 bits"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLCORE} "${PRODUCT_NAME} core files"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLSERVER} "${PRODUCT_NAME} server files"
!insertmacro MUI_DESCRIPTION_TEXT ${INSTALLAOS} "${PRODUCT_NAME} client files"
; !insertmacro MUI_DESCRIPTION_TEXT ${INSTALLPLANNER} "${PRODUCT_NAME} planner files"
; !insertmacro MUI_DESCRIPTION_TEXT ${INSTALLINITIALIZER} "${PRODUCT_NAME} initializer files"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
SetShellVarContext all
;RMDir /r $INSTDIR
${If} ${FileExists} "$PROGRAMFILES\FMBackup\*.*"
${Else}
CreateDirectory "$PROGRAMFILES\FMBackup"
${EndIf}
CopyFiles "$INSTDIR\Exported Files\*.*" "$PROGRAMFILES\FMBackup"
RMDir /r $INSTDIR
CreateDirectory "$INSTDIR\Exported Files"
CopyFiles "$PROGRAMFILES\FMBackup\*.*" "$INSTDIR\Exported Files"
RMDir /r "$PROGRAMFILES\FMBackup"
Delete "$DESKTOP\Initializer.lnk"
Delete "$DESKTOP\PlannerClient.lnk"
Delete "$DESKTOP\PlannerStandalone.lnk"
Delete "$DESKTOP\AosClient.lnk"
; Delete "$DESKTOP\AosStandalone.lnk"
Delete "$DESKTOP\Server.lnk"
RMDir /r "$SMPROGRAMS\${PRODUCT_GROUP}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
;remove registry keys for uninstaller in programs and features in control panel
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
SetAutoClose true
SectionEnd