Skip to content

Commit f4967e8

Browse files
authored
MSI: Add support for INSTALLER_UNATTENDED (#1276)
* Add support for INSTALLER_UNATTENDED * Add news * Bump briefcase dependency * Bump briefcase in all other files * Enable test for INSTALLER_UNATTENDED (MSI)
1 parent a2a7fa6 commit f4967e8

13 files changed

Lines changed: 39 additions & 26 deletions

CONSTRUCT.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ Path to a post-install script. Some notes:
390390
`%INSTALLER_PLAT%` environment variables. `%INSTALLER_TYPE%` is set to `EXE`.
391391
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`/S`), `"0"` otherwise.
392392
- For Windows `.msi` installers, the script must be a `.bat` file.
393-
The same variables as `.exe` installers are available, except
394-
`%INSTALLER_TYPE%` is set to `MSI` and `%INSTALLER_UNATTENDED%` is not available.
393+
The same variables as `.exe` installers are available.
394+
`%INSTALLER_TYPE%` is set to `MSI`.
395+
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`msiexec /qn`), `"0"` otherwise.
395396

396397
If necessary, you can activate the installed `base` environment like this:
397398

constructor/_schema.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,9 @@ class ConstructorConfiguration(BaseModel):
561561
`%INSTALLER_PLAT%` environment variables. `%INSTALLER_TYPE%` is set to `EXE`.
562562
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`/S`), `"0"` otherwise.
563563
- For Windows `.msi` installers, the script must be a `.bat` file.
564-
The same variables as `.exe` installers are available, except
565-
`%INSTALLER_TYPE%` is set to `MSI` and `%INSTALLER_UNATTENDED%` is not available.
564+
The same variables as `.exe` installers are available.
565+
`%INSTALLER_TYPE%` is set to `MSI`.
566+
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`msiexec /qn`), `"0"` otherwise.
566567
567568
If necessary, you can activate the installed `base` environment like this:
568569

constructor/briefcase/pre_uninstall.bat

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ set "INSTALLER_NAME={{ installer_name }}"
4444
set "INSTALLER_VER={{ installer_version }}"
4545
set "INSTALLER_PLAT={{ installer_platform }}"
4646
set "INSTALLER_TYPE=MSI"
47-
rem INSTALLER_UNATTENDED is not available for MSI installers.
48-
rem Detecting silent mode requires UILevel from WiX, which would need
49-
rem changes to the briefcase-windows-app-template to pass to this script.
5047

5148
rem Determine install mode from .nonadmin marker file written at install time
5249
if exist "%BASE_PATH%\.nonadmin" (

constructor/briefcase/run_installation.bat

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ set "INSTALLER_NAME={{ installer_name }}"
6161
set "INSTALLER_VER={{ installer_version }}"
6262
set "INSTALLER_PLAT={{ installer_platform }}"
6363
set "INSTALLER_TYPE=MSI"
64-
rem INSTALLER_UNATTENDED is not available for MSI installers.
65-
rem Detecting silent mode requires UILevel from WiX, which would need
66-
rem changes to the briefcase-windows-app-template to pass to this script.
6764

6865
{%- if add_debug %}
6966
>> "%LOG%" echo ==== run_installation start ====

constructor/data/construct.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@
10531053
}
10541054
],
10551055
"default": null,
1056-
"description": "Path to a post-install script. Some notes:\n- For Unix `.sh` installers, the shebang line is respected if present; otherwise, the script is run by the POSIX shell `sh`. Note that the use of a shebang can reduce the portability of the installer. The installation path is available as `${PREFIX}`. Installer metadata is available in the `${INSTALLER_NAME}`, `${INSTALLER_VER}`, `${INSTALLER_PLAT}` environment variables. `${INSTALLER_TYPE}` is set to `SH`. `${INSTALLER_UNATTENDED}` will be `\"1\"` in batch mode (`-b`), `\"0\"` otherwise.\n- For PKG installers, the shebang line is respected if present; otherwise, `bash` is used. The same variables mentioned for `sh` installers are available here. `${INSTALLER_TYPE}` is set to `PKG`. `${INSTALLER_UNATTENDED}` will be `\"1\"` for command line installs, `\"0\"` otherwise.\n- For Windows `.exe` installers, the script must be a `.bat` file. Installation path is available as `%PREFIX%`. Metadata about the installer can be found in the `%INSTALLER_NAME%`, `%INSTALLER_VER%`, `%INSTALLER_PLAT%` environment variables. `%INSTALLER_TYPE%` is set to `EXE`. `%INSTALLER_UNATTENDED%` will be `\"1\"` in silent mode (`/S`), `\"0\"` otherwise.\n- For Windows `.msi` installers, the script must be a `.bat` file. The same variables as `.exe` installers are available, except `%INSTALLER_TYPE%` is set to `MSI` and `%INSTALLER_UNATTENDED%` is not available.\nIf necessary, you can activate the installed `base` environment like this:\n- Unix: `. \"$PREFIX/etc/profile.d/conda.sh\" && conda activate \"$PREFIX\"`\n- Windows: `call \"%PREFIX%\\Scripts\\activate.bat\"`",
1056+
"description": "Path to a post-install script. Some notes:\n- For Unix `.sh` installers, the shebang line is respected if present; otherwise, the script is run by the POSIX shell `sh`. Note that the use of a shebang can reduce the portability of the installer. The installation path is available as `${PREFIX}`. Installer metadata is available in the `${INSTALLER_NAME}`, `${INSTALLER_VER}`, `${INSTALLER_PLAT}` environment variables. `${INSTALLER_TYPE}` is set to `SH`. `${INSTALLER_UNATTENDED}` will be `\"1\"` in batch mode (`-b`), `\"0\"` otherwise.\n- For PKG installers, the shebang line is respected if present; otherwise, `bash` is used. The same variables mentioned for `sh` installers are available here. `${INSTALLER_TYPE}` is set to `PKG`. `${INSTALLER_UNATTENDED}` will be `\"1\"` for command line installs, `\"0\"` otherwise.\n- For Windows `.exe` installers, the script must be a `.bat` file. Installation path is available as `%PREFIX%`. Metadata about the installer can be found in the `%INSTALLER_NAME%`, `%INSTALLER_VER%`, `%INSTALLER_PLAT%` environment variables. `%INSTALLER_TYPE%` is set to `EXE`. `%INSTALLER_UNATTENDED%` will be `\"1\"` in silent mode (`/S`), `\"0\"` otherwise.\n- For Windows `.msi` installers, the script must be a `.bat` file. The same variables as `.exe` installers are available. `%INSTALLER_TYPE%` is set to `MSI`. `%INSTALLER_UNATTENDED%` will be `\"1\"` in silent mode (`msiexec /qn`), `\"0\"` otherwise.\nIf necessary, you can activate the installed `base` environment like this:\n- Unix: `. \"$PREFIX/etc/profile.d/conda.sh\" && conda activate \"$PREFIX\"`\n- Windows: `call \"%PREFIX%\\Scripts\\activate.bat\"`",
10571057
"title": "Post Install"
10581058
},
10591059
"post_install_desc": {

dev/extra-requirements-windows.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
conda-forge::briefcase>=0.3.26
1+
conda-forge::briefcase>=0.4.3
22
conda-forge::nsis>=3.08=*_log_*
33
conda-forge::tomli-w>=1.2.0

docs/source/construct-yaml.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ Path to a post-install script. Some notes:
390390
`%INSTALLER_PLAT%` environment variables. `%INSTALLER_TYPE%` is set to `EXE`.
391391
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`/S`), `"0"` otherwise.
392392
- For Windows `.msi` installers, the script must be a `.bat` file.
393-
The same variables as `.exe` installers are available, except
394-
`%INSTALLER_TYPE%` is set to `MSI` and `%INSTALLER_UNATTENDED%` is not available.
393+
The same variables as `.exe` installers are available.
394+
`%INSTALLER_TYPE%` is set to `MSI`.
395+
`%INSTALLER_UNATTENDED%` will be `"1"` in silent mode (`msiexec /qn`), `"0"` otherwise.
395396

396397
If necessary, you can activate the installed `base` environment like this:
397398

examples/scripts/post_install.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ if not "%INSTALLER_NAME%" == "Scripts" exit 1
33
if not "%INSTALLER_VER%" == "1.0.0" exit 1
44
if not "%INSTALLER_PLAT%" == "win-64" exit 1
55
if not "%INSTALLER_TYPE%" == "EXE" if not "%INSTALLER_TYPE%" == "MSI" exit 1
6-
rem INSTALLER_UNATTENDED is not yet set by MSI installers (see conda/constructor#1276).
7-
if "%INSTALLER_TYPE%" == "EXE" if not "%INSTALLER_UNATTENDED%" == "1" exit 1
6+
if not "%INSTALLER_UNATTENDED%" == "1" exit 1
87
if "%PREFIX%" == "" exit 1
98
if not "%CUSTOM_VARIABLE_1%" == "FIR$T-CUSTOM_STRING WITH SPACES AND @*! CHARACTERS" exit 1
109
if not "%CUSTOM_VARIABLE_2%" == "$ECOND-CUSTOM_STRING WITH SPACES AND @*! CHARACTERS" exit 1

examples/scripts/pre_install.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ if not "%INSTALLER_NAME%" == "Scripts" exit 1
22
if not "%INSTALLER_VER%" == "1.0.0" exit 1
33
if not "%INSTALLER_PLAT%" == "win-64" exit 1
44
if not "%INSTALLER_TYPE%" == "EXE" if not "%INSTALLER_TYPE%" == "MSI" exit 1
5-
rem INSTALLER_UNATTENDED is not yet set by MSI installers (see conda/constructor#1276).
6-
if "%INSTALLER_TYPE%" == "EXE" if not "%INSTALLER_UNATTENDED%" == "1" exit 1
5+
if not "%INSTALLER_UNATTENDED%" == "1" exit 1
76
if "%PREFIX%" == "" exit 1
87
if not "%CUSTOM_VARIABLE_1%" == "FIR$T-CUSTOM_STRING WITH SPACES AND @*! CHARACTERS" exit 1
98
if not "%CUSTOM_VARIABLE_2%" == "$ECOND-CUSTOM_STRING WITH SPACES AND @*! CHARACTERS" exit 1

news/1276-msi-installer-unattended

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Enhancements
2+
3+
* <news item>
4+
5+
### Bug fixes
6+
7+
* <news item>
8+
9+
### Deprecations
10+
11+
* <news item>
12+
13+
### Docs
14+
15+
* Updated docs to clarify the use of `INSTALLER_UNATTENDED` within the context of MSI installers, and updated minimum `briefcase` version to `0.4.3`. (#1278)
16+
17+
### Other
18+
19+
* <news item>

0 commit comments

Comments
 (0)