Repository: nvaccess/nvda

Issue:
Add a command line parameter to disable start at logon screen for silent installations
### Steps to reproduce:
1. Install NVDA with the --install-silent flag
2. Restart the system.

### Actual behavior:
NVDA runs at the logon screen.

### Expected behavior:
NVDA shouldn't run at the logon screen when explicitly chosen to install silent.

### Additional details
This issue is relevant for system administrators who want to install NVDA silently on a multi user system. IN the current situation, it is not possible to specify the start at logon behaviour from the command line. I think it makes sense to make False the default for first time silent installations. Alternatively, we could consider introducing a new command line parameter.

cc @michaeldcurran, @feerrenrut, @derekriemer

### System configuration:
Not applicable. This issue is unrelated to the Windows version of use and I believe it has been there since the  --install-silent parameter was introduced.


Discussion:
I would prefer a separate commandline argument. I don't think it is 
logical to assume that all silent installations do not require NVDA on 
logon.


@michaelDCurran & @leonardder I would expect that the majority or silent installs do not require NVDA on log on, but not all. However, I'm concerned that changing the behaviour here could break some install processes somewhere. So I would advise on keeping the current default, and adding a new option to `--disable-start-at-logon`. If everyone agrees, then perhaps we can change the title / description of this issue?
@feerrenrut: Sound sreasonable. I will follow these implementation guidelines.

Note that the default will enable NVDA at logon, unless this is not a first installation and NVDA has been disabled at the logon screen. However, when this config parameter is provided, I tend to force disable NVDA at logon, so ignoring the current state of the setting.

Resolving patch:
diff --git a/source/gui/installerGui.py b/source/gui/installerGui.py
--- a/source/gui/installerGui.py
+++ b/source/gui/installerGui.py
@@ -80,7 +80,17 @@ def doInstall(createDesktopShortcut,startOnLogon,copyPortableConfig,isUpdate,sil
 
 def doSilentInstall(startAfterInstall=True):
 	prevInstall=installer.comparePreviousInstall() is not None
-	doInstall(installer.isDesktopShortcutInstalled() if prevInstall else True,config.getStartOnLogonScreen() if prevInstall else True,False,prevInstall,silent=True,startAfterInstall=startAfterInstall)
+	startOnLogon=globalVars.appArgs.enableStartOnLogon
+	if startOnLogon is None:
+		startOnLogon=config.getStartOnLogonScreen() if prevInstall else True
+	doInstall(
+		installer.isDesktopShortcutInstalled() if prevInstall else True,
+		startOnLogon,
+		False,
+		prevInstall,
+		silent=True,
+		startAfterInstall=startAfterInstall
+	)
 
 class InstallerDialog(wx.Dialog, DpiScalingHelperMixin):
 
@@ -147,8 +157,11 @@ def __init__(self, parent, isUpdate):
 		# Translators: The label of a checkbox option in the Install NVDA dialog.
 		startOnLogonText = _("Use NVDA on the Windows &logon screen")
 		self.startOnLogonCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=startOnLogonText))
-		self.startOnLogonCheckbox.Value = config.getStartOnLogonScreen() if self.isUpdate else True
-		
+		if globalVars.appArgs.enableStartOnLogon is not None:
+			self.startOnLogonCheckbox.Value = globalVars.appArgs.enableStartOnLogon
+		else:
+			self.startOnLogonCheckbox.Value = config.getStartOnLogonScreen() if self.isUpdate else True
+
 		shortcutIsPrevInstalled=installer.isDesktopShortcutInstalled()
 		if self.isUpdate and shortcutIsPrevInstalled:
 			# Translators: The label of a checkbox option in the Install NVDA dialog.
@@ -289,6 +302,8 @@ def __init__(self, parent):
 		dirDialogTitle = _("Select portable  directory")
 		directoryEntryControl = groupHelper.addItem(gui.guiHelper.PathSelectionHelper(self, browseText, dirDialogTitle))
 		self.portableDirectoryEdit = directoryEntryControl.pathControl
+		if globalVars.appArgs.portablePath:
+			self.portableDirectoryEdit.Value = os.path.abspath(globalVars.appArgs.portablePath)
 
 		# Translators: The label of a checkbox option in the Create Portable NVDA dialog.
 		copyConfText = _("Copy current &user configuration")


Test patch: