mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[Host] Installer command line options and install location selection add
This commit is contained in:
parent
b2980fea63
commit
e2f2437ef4
@ -40,15 +40,64 @@ InstallDir "$PROGRAMFILES64\Looking-Glass"
|
||||
|
||||
;Install and uninstall pages
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
|
||||
Function ShowHelpMessage
|
||||
!define line1 "Command line options:$\r$\n$\r$\n"
|
||||
!define line2 "/S - silent install (must be uppercase)$\r$\n"
|
||||
!define line3 "/D=path\to\install\folder - Change install directory$\r$\n"
|
||||
!define line4 " (Must be uppercase, the last option given and no quotes)$\r$\n$\r$\n"
|
||||
!define line5 "/startmenu - create start menu shortcut$\r$\n"
|
||||
!define line6 "/desktop - create desktop shortcut"
|
||||
MessageBox MB_OK "${line1}${line2}${line3}${line4}${line5}${line6}"
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Function .onInit
|
||||
|
||||
var /GLOBAL cmdLineParams
|
||||
Push $R0
|
||||
${GetParameters} $cmdLineParams
|
||||
ClearErrors
|
||||
|
||||
${GetOptions} $cmdLineParams '/?' $R0
|
||||
IfErrors +2 0
|
||||
Call ShowHelpMessage
|
||||
|
||||
${GetOptions} $cmdLineParams '/H' $R0
|
||||
IfErrors +2 0
|
||||
Call ShowHelpMessage
|
||||
|
||||
Pop $R0
|
||||
|
||||
|
||||
Var /GLOBAL option_startMenu
|
||||
Var /GLOBAL option_desktop
|
||||
StrCpy $option_startMenu 0
|
||||
StrCpy $option_desktop 0
|
||||
|
||||
Push $R0
|
||||
|
||||
${GetOptions} $cmdLineParams '/startmenu' $R0
|
||||
IfErrors +2 0
|
||||
StrCpy $option_startMenu 1
|
||||
|
||||
${GetOptions} $cmdLineParams '/desktop' $R0
|
||||
IfErrors +2 0
|
||||
StrCpy $option_desktop 1
|
||||
|
||||
Pop $R0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;Install
|
||||
Section "Install" Section1
|
||||
SectionIn RO
|
||||
Section "-Install" Section1
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
File ..\build\looking-glass-host.exe
|
||||
@ -83,32 +132,42 @@ SectionEnd
|
||||
Section "Auto Start Looking-Glass" Section2
|
||||
|
||||
nsExec::Exec 'SCHTASKS /Delete /F /TN "Looking Glass"'
|
||||
nsExec::Exec 'SCHTASKS /Create /TN "Looking Glass" /SC ONLOGON /RL HIGHEST /TR "C:\Program Files\Looking-Glass\looking-glass-host.exe"'
|
||||
nsExec::Exec 'SCHTASKS /Create /TN "Looking Glass" /SC ONLOGON /RL HIGHEST /TR "$INSTDIR\looking-glass-host.exe"'
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section /o "Desktop Shortcut" Section3
|
||||
SetShellVarContext all
|
||||
CreateShortCut $DESKTOP\Looking-Glass-Host.lnk $INSTDIR\looking-glass-host.exe
|
||||
StrCpy $option_desktop 1
|
||||
SectionEnd
|
||||
|
||||
Section /o "Start Menu Shortcut" Section4
|
||||
SetShellVarContext all
|
||||
CreateShortCut $STARTMENU\Looking-Glass-Host.lnk $INSTDIR\looking-glass-host.exe
|
||||
StrCpy $option_startMenu 1
|
||||
SectionEnd
|
||||
|
||||
Section "-Hidden Start Menu" Section5
|
||||
SetShellVarContext all
|
||||
|
||||
${If} $option_startMenu == 1
|
||||
CreateShortCut $SMPROGRAMS\Looking-Glass-Host.lnk $INSTDIR\looking-glass-host.exe
|
||||
${EndIf}
|
||||
|
||||
Section "Uninstall" Section5
|
||||
${If} $option_desktop == 1
|
||||
CreateShortCut $DESKTOP\Looking-Glass-Host.lnk $INSTDIR\looking-glass-host.exe
|
||||
${EndIf}
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall" Section6
|
||||
SetShellVarContext all
|
||||
|
||||
nsExec::Exec 'SCHTASKS /Delete /F /TN "Looking Glass"'
|
||||
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass"
|
||||
Delete $STARTMENU\Looking-Glass-Host.lnk
|
||||
Delete $SMPROGRAMS\Looking-Glass-Host.lnk
|
||||
Delete $DESKTOP\Looking-Glass-Host.lnk
|
||||
Delete $INSTDIR\uninstaller.exe
|
||||
Delete $INSTDIR\looking-glass-host.exe
|
||||
Delete $INSTDIR\LICENSE
|
||||
Delete $INSTDIR\LICENSE.txt
|
||||
|
||||
RMDir $INSTDIR
|
||||
|
||||
@ -125,4 +184,4 @@ LangString DESC_Section4 ${LANG_ENGLISH} "Create start menu shortcut."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
Loading…
Reference in New Issue
Block a user