Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: support the /S switch for restricted user accounts running silent installations #6

Merged
merged 18 commits into from
Nov 21, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d37d7e7
windows: Don't try to install to c:\ProgramData if c:\Program Files …
mikesteele81 Jun 1, 2012
8ddf35d
Check for a currently running installation even when running silently.
mikesteele81 Jun 8, 2012
a023e1f
AddDesktopSC variable assigned to in .oninit. UI's selection depends …
mikesteele81 Jun 8, 2012
c6bd1b3
Define DESKTOP_SHORTCUT_* defines for the AddDesktopSC variable.
mikesteele81 Jun 8, 2012
6a66249
AddStartMenuSC variable assigned to in .oninit. UI's selection depend…
mikesteele81 Jun 8, 2012
ef49a81
Define START_MENU_SHORTCUT_* defines for the AddStartMenuSC variable.
mikesteele81 Jun 8, 2012
25188f1
adjust line wrapping in comment.
mikesteele81 Jun 8, 2012
acf334e
AddQuickLaunchSC variable assigned to in .oninit. UI's selection depe…
mikesteele81 Jun 8, 2012
f4f11ce
Define QUICKLAUNCH_SHORTCUT_* defines for the AddQuickLaunchSC variable.
mikesteele81 Jun 8, 2012
60e2b2f
AddQuickLaunchSC indicates user preference. Its value should not depe…
mikesteele81 Jun 8, 2012
49766ec
Ensure CheckExistingInstall gets called even in silent installation.
mikesteele81 Jun 15, 2012
18886e7
Remove CheckCustomCommon. It was only called from one place.
mikesteele81 Jun 15, 2012
83456cc
Remove PreDirectoryCommon. It was only called from one place.
mikesteele81 Jun 15, 2012
38dd10d
Remove LeaveDirectoryCommon. It was only called from one place.
mikesteele81 Jun 15, 2012
33e1214
silent install: Check that there is write access and disk space in th…
mikesteele81 Jun 15, 2012
cbd04cd
Move INSTALLTYPE_* defines to defines.nsi.
mikesteele81 Jun 7, 2012
e0391a6
Set InstallType once in .oninit and once more in the UI. Add a define…
mikesteele81 Jun 7, 2012
77550d0
silent install: Correct default install location.
mikesteele81 Jun 15, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 5 additions & 158 deletions win/installer/common.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@

FindWindow $R7 "$R8"
${If} $R7 <> 0 ; integer comparison
MessageBox MB_OK|MB_ICONQUESTION "$R9"
MessageBox MB_OK|MB_ICONQUESTION "$R9" /SD IDOK
Abort
${EndIf}

Expand Down Expand Up @@ -4477,47 +4477,8 @@
!macroend


################################################################################
# User interface callback helper defines and macros

/* Install type defines */
!ifndef INSTALLTYPE_BASIC
!define INSTALLTYPE_BASIC 1
!endif

!ifndef INSTALLTYPE_CUSTOM
!define INSTALLTYPE_CUSTOM 2
!endif

/**
* Checks whether to display the current page (e.g. if not performing a custom
* install don't display the custom pages).
*/
!macro CheckCustomCommon

!ifndef CheckCustomCommon
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define CheckCustomCommon "!insertmacro CheckCustomCommonCall"

Function CheckCustomCommon

; Abort if not a custom install
IntCmp $InstallType ${INSTALLTYPE_CUSTOM} +2 +1 +1
Abort

FunctionEnd

!verbose pop
!endif
!macroend

!macro CheckCustomCommonCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call CheckCustomCommon
!verbose pop
!macroend
##############################################################################
# User interface callback helper macros

/**
* Unloads dll's and releases references when the installer and uninstaller
Expand Down Expand Up @@ -4649,9 +4610,6 @@
${ElevateUAC}

${If} $R8 != ""
; Default install type
StrCpy $InstallType ${INSTALLTYPE_BASIC}

${Unless} ${Silent}
; Manually check for /S in the command line due to Bug 506867
ClearErrors
Expand Down Expand Up @@ -5049,17 +5007,10 @@
!endif

; If the user doesn't have write access to the installation directory set
; the installation directory to a subdirectory of the All Users application
; directory and if the user can't write to that location set the installation
; directory to a subdirectory of the users local application directory
; (e.g. non-roaming).
; the installation directory to a subdirectory of the user's local
; application directory (e.g. non-roaming).
${CanWriteToInstallDir} $R9
StrCmp "$R9" "false" +1 finish_check_install_dir

SetShellVarContext all ; Set SHCTX to All Users
StrCpy $INSTDIR "$APPDATA\${BrandFullName}\"
${CanWriteToInstallDir} $R9
StrCmp "$R9" "false" +2 +1
StrCpy $INSTDIR "$LOCALAPPDATA\${BrandFullName}\"

finish_check_install_dir:
Expand Down Expand Up @@ -5090,110 +5041,6 @@
!verbose pop
!macroend

/**
* Called from the MUI preDirectory function to verify there is enough disk
* space for the installation and the installation directory is writable.
*
* $R9 = returned value from CheckDiskSpace and CanWriteToInstallDir macros
*/
!macro PreDirectoryCommon

!ifndef PreDirectoryCommon
!insertmacro CanWriteToInstallDir
!insertmacro CheckDiskSpace

!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define PreDirectoryCommon "!insertmacro PreDirectoryCommonCall"

Function PreDirectoryCommon
Push $R9

IntCmp $InstallType ${INSTALLTYPE_CUSTOM} end +1 +1
${CanWriteToInstallDir} $R9
StrCmp "$R9" "false" end +1
${CheckDiskSpace} $R9
StrCmp "$R9" "false" end +1
Abort

end:

Pop $R9
FunctionEnd

!verbose pop
!endif
!macroend

!macro PreDirectoryCommonCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call PreDirectoryCommon
!verbose pop
!macroend

/**
* Called from the MUI leaveDirectory function
*
* @param _WARN_DISK_SPACE
* Message displayed when there isn't enough disk space to perform the
* installation.
* @param _WARN_WRITE_ACCESS
* Message displayed when the installer does not have write access to
* $INSTDIR.
*
* $R7 = returned value from CheckDiskSpace and CanWriteToInstallDir macros
* $R8 = _WARN_DISK_SPACE
* $R9 = _WARN_WRITE_ACCESS
*/
!macro LeaveDirectoryCommon

!ifndef LeaveDirectoryCommon
!insertmacro CheckDiskSpace
!insertmacro CanWriteToInstallDir

!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define LeaveDirectoryCommon "!insertmacro LeaveDirectoryCommonCall"

Function LeaveDirectoryCommon
Exch $R9
Exch 1
Exch $R8
Push $R7

${CanWriteToInstallDir} $R7
${If} $R7 == "false"
MessageBox MB_OK|MB_ICONEXCLAMATION "$R9"
Abort
${EndIf}

${CheckDiskSpace} $R7
${If} $R7 == "false"
MessageBox MB_OK|MB_ICONEXCLAMATION "$R8"
Abort
${EndIf}

Pop $R7
Exch $R8
Exch 1
Exch $R9
FunctionEnd

!verbose pop
!endif
!macroend

!macro LeaveDirectoryCommonCall _WARN_DISK_SPACE _WARN_WRITE_ACCESS
!verbose push
Push "${_WARN_DISK_SPACE}"
Push "${_WARN_WRITE_ACCESS}"
!verbose ${_MOZFUNC_VERBOSE}
Call LeaveDirectoryCommon
!verbose pop
!macroend


################################################################################
# Install Section common macros.

Expand Down
20 changes: 20 additions & 0 deletions win/installer/defines.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,23 @@ VIAddVersionKey "FileVersion" "${AppVersion}"
VIAddVersionKey "ProductVersion" "${AppVersion}"
# Comments is not used but left below commented out for future reference
# VIAddVersionKey "Comments" "Comments"

# These are used for keeping track of user preferences. They are set to a
# default value in the installer's .OnInit callback, and then conditionally
# modified through the UI or an .ini file.

!define DESKTOP_SHORTCUT_DISABLED 0
!define DESKTOP_SHORTCUT_ENABLED 1
!define DESKTOP_SHORTCUT_DEFAULT ${DESKTOP_SHORTCUT_ENABLED}

!define START_MENU_SHORTCUT_DISABLED 0
!define START_MENU_SHORTCUT_ENABLED 1
!define START_MENU_SHORTCUT_DEFAULT ${START_MENU_SHORTCUT_ENABLED}

!define QUICKLAUNCH_SHORTCUT_DISABLED 0
!define QUICKLAUNCH_SHORTCUT_ENABLED 1
!define QUICKLAUNCH_SHORTCUT_DEFAULT ${QUICKLAUNCH_SHORTCUT_ENABLED}

!define INSTALLTYPE_BASIC 1
!define INSTALLTYPE_CUSTOM 2
!define INSTALLTYPE_DEFAULT ${INSTALLTYPE_BASIC}
Loading