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

Installer updates #2364

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Installer updates #2364

wants to merge 15 commits into from

Conversation

MichaelHuth
Copy link
Collaborator

@MichaelHuth MichaelHuth commented Mar 5, 2025

close #2206

If calling one of the powershell scripts fail the installer will now catch that and report through Messagebox (non-silent case).
In any case it will also return errorlevel code 1 then.

@MichaelHuth MichaelHuth self-assigned this Mar 5, 2025
@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch from 1b15834 to 149eeb7 Compare March 7, 2025 11:56
@MichaelHuth MichaelHuth assigned t-b and unassigned MichaelHuth Mar 7, 2025
NSIS is an installer system.
The plugin ExecCmd is not supported and not working anymore.
The replacement plugin is ExecDos.

While the API of ExecDos looks similar to ExecCmd it
behaves in a lot aspects differently.

Also some documented functionality like "application output to log file"
was not possible to get working.
Environment variables as part of the command line are not supported.
(Need to be resolved before)

Thus, the method used now is where the plugin puts the output on the stack.
As workaround for the piping the stack is written to a file.
Then the second command is called in a separate call.
When running the installer it attempts first to uninstall MIES
for all users and then for the current user. There is a mutex
setup that prevents running multiple uninstallers at the same time.

However, the waiting logic for the uninstaller process to finish did not
work. Thus, when there was a admin/all user installation and due to some reason
a user installation then while the all user installation was uninstalled the
uninstaller for the current user install started and gave the error.

Solution:
- Prevent the uninstaller from unpacking a independent executable which allows
ExecWait to wait.
- Delete uninstall.exe and folder afterwards from installer.

See also https://nsis.sourceforge.io/Docs/Chapter3.html at the very bottom.
(Note that the executable is uninstall.exe and not uninstaller.exe as written in the docu)
@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch from 4d2b625 to 8bac10b Compare March 10, 2025 17:33
@MichaelHuth
Copy link
Collaborator Author

@t-b I noticed that we use the option to exit with an non-zero error level code only on one other location in the installer. I was pondering if we shouldn't actually add that to all cases where we quit early due to e.g. non-fulfilled requirements.

Currently this is only caught by the fact that an early abort leaves an incomplete installation. In this change the powershell scripts are called at the end, where it is not immediatly obvious that the installer quit early in silent mode.

@t-b
Copy link
Collaborator

t-b commented Mar 10, 2025

@t-b I noticed that we use the option to exit with an non-zero error level code only on one other location in the installer. I was pondering if we shouldn't actually add that to all cases where we quit early due to e.g. non-fulfilled requirements.

Currently this is only caught by the fact that an early abort leaves an incomplete installation. In this change the powershell scripts are called at the end, where it is not immediatly obvious that the installer quit early in silent mode.

Yes let's do that.

@MichaelHuth MichaelHuth assigned MichaelHuth and t-b and unassigned t-b and MichaelHuth Mar 11, 2025
@t-b
Copy link
Collaborator

t-b commented Mar 11, 2025

Review:
f0843d7 (Update NSIS to version 3.10, 2025-03-05)
25c5c18 (Fixes in installer script for NSIS 3.10 update, 2025-03-05)
f2960b3 (Installer: Remove hint for MIES installation for 32-bit Igor Pro, 2025-03-06)
37789e0 (Installer: Bring installer to front after uninstaller ran, 2025-03-06)
2895e31 (Installer: Remove "Permanently remove MIES" MsgBox on uninstallation, 2025-03-06)
1775958 (Installer: Fix "uninstaller already running" error, 2025-03-06)
229a1c6 (Installer: Attempt admin uninstall only when actually admin, 2025-03-06)

Looks all good.

8c2db1c (Installer: Write out configuration to json file, 2025-03-06)

  • How about creating the empty file on the fly in tools/create-installer.json?
  • Can we have a short comment block in the code how the JSON looks like?
  • The location of the installation_configuration.json should also be moved one level up next to version.txt.

bcf4eff (CI: Build release installer as unelevated version, 2025-03-07)

  • While technically correct how about
        run: tools/create-installer.sh unelevated

instead?

  • This change breaks the installer naming, as now also the user installer has the -cis suffix.

69062ad (Installer: Execute the ASRL disable script again, 2025-03-07)
8bac10b (Installer: Add handling of failed FixOffice365.ps1 call, 2025-03-10)
0e00a14 (Installer: Return well defined error code for install fail conditions, 2025-03-11)

Rest looks good.

  • Please also adapt the documentation in Packages/doc/installation.rst.

@t-b t-b assigned MichaelHuth and unassigned t-b Mar 11, 2025
JSON file is $INSTDIR/installation_configuration.json

The following data is saved:
/Installation/User <string> (either "all" or "current")
/Installation/WithHardware <number> (either 1 or 0)

Added file to repo, such that it is listed in the files that are part
of the installation/uninstallation
@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch from 0e00a14 to 3fe8ba4 Compare March 12, 2025 11:56
@MichaelHuth
Copy link
Collaborator Author

@t-b

This change breaks the installer naming, as now also the user installer has the -cis suffix.

I can not reproduce this. The -cis naming is done in create-installer.sh and there was no change for this.
The unelevated installer still has the -cis suffix, whereas the elevated does not.

@t-b
Copy link
Collaborator

t-b commented Mar 12, 2025

@t-b

This change breaks the installer naming, as now also the user installer has the -cis suffix.

I can not reproduce this. The -cis naming is done in create-installer.sh and there was no change for this. The unelevated installer still has the -cis suffix, whereas the elevated does not.

create-installer.sh has this code:

if [ "$#" -eq 0 ]
then
  echo "RequestExecutionLevel admin" > installer/$NSISREQUEST
else
  echo "RequestExecutionLevel user" > installer/$NSISREQUEST
  sed -i 's/\.exe/-cis.exe/' installer/$NSISOUTFILE
fi

so if I pass an argument I get an user installer but the name has the cis suffix.

@t-b
Copy link
Collaborator

t-b commented Mar 12, 2025

AFAIU we can properly ditch the cis/dev installer as the only difference was the UAC elevation. Which we now don't do anymore in general.

@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch from 3fe8ba4 to 45232ca Compare March 12, 2025 13:45
@MichaelHuth MichaelHuth assigned t-b and unassigned MichaelHuth Mar 12, 2025
@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch 2 times, most recently from d4b17e3 to 1c68eac Compare March 12, 2025 17:24
MichaelHuth and others added 7 commits March 12, 2025 23:22
The -cis installer filename suffix for the unelevated installer was removed.
The name was changed in f146d2e (TurnOffASLR: Fix powershell script
name, 2024-08-18) but the installer was still trying the old name. And
it did not complain.
If the call failed the installer returns error code 1.
This allows for the silent case to catch this installation error.
A few macros had to be adapted that used relative jump marks.
Relative jump marks are not practical for macros in macros.
Thus, the solution through a unique id (caller line number) was added.
The powershell script uses the Set-ProcessMitigation CmdLet.
However, when calling powershell.exe from the 32-bit installer the 32-bit
powershell is started and it does not support the CmdLet.

This commit fixes this by explicitly calling the 64 bit powershell executable.
- The script was only required for 32-bit OS and is now obsolete
Mitigation options are only saved by the process name, such that
Igor64.exe is sufficient.
@MichaelHuth MichaelHuth force-pushed the feature/2364-mh_update_installer branch from 1c68eac to e8e1335 Compare March 12, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various installer bugfixes
2 participants