|
| 1 | +# Usage: |
| 2 | +# Run the following commands to enable local manifest files and installer hash override with admin privileges: |
| 3 | +# winget settings --enable LocalManifestFiles |
| 4 | +# winget settings --enable InstallerHashOverride |
| 5 | + |
| 6 | +use common.nu [check-user-install, check-version-match, check-local-machine-install] |
| 7 | + |
| 8 | +const VERSION = '0.105.1' |
| 9 | +const PREV_VERSION = '0.105.0' |
| 10 | +const LAST_VERSION = '0.105.1' |
| 11 | +const MSI_PKG = 'wix\bin\x64\Release\nu-x64.msi' |
| 12 | +const PER_MACHINE_INSTALL_DIR = 'C:\Program Files\nu' |
| 13 | +const PER_USER_INSTALL_DIR = $'($nu.home-path)\AppData\Local\Programs\nu' |
| 14 | +const WINGET_ARGS = [ |
| 15 | + --silent |
| 16 | + --ignore-security-hash |
| 17 | + --disable-interactivity |
| 18 | + --accept-source-agreements |
| 19 | + --accept-package-agreements |
| 20 | + ] |
| 21 | + |
| 22 | +def main [--msi(-m)] { |
| 23 | + if $msi { |
| 24 | + test-msi-per-user-install |
| 25 | + test-msi-per-machine-install |
| 26 | + } |
| 27 | + test-winget-per-user-install |
| 28 | + test-winget-per-user-upgrade |
| 29 | + test-winget-per-machine-install |
| 30 | + test-winget-per-machine-upgrade |
| 31 | +} |
| 32 | + |
| 33 | +export def test-msi-per-user-install [] { |
| 34 | + winget uninstall nushell | complete |
| 35 | + print $'Using msiexec to test MSI (ansi g)per-user(ansi reset) installation' |
| 36 | + print '-------------------------------------------------------------------' |
| 37 | + msiexec /i $MSI_PKG MSIINSTALLPERUSER=1 /quiet /qn /L*V install.txt |
| 38 | + check-user-install $PER_USER_INSTALL_DIR |
| 39 | + check-version-match $VERSION $PER_USER_INSTALL_DIR |
| 40 | + winget list nushell --accept-source-agreements |
| 41 | +} |
| 42 | + |
| 43 | +export def test-msi-per-machine-install [] { |
| 44 | + winget uninstall nushell | complete |
| 45 | + print $'(char nl)Using msiexec to test MSI (ansi g)machine scope(ansi reset) installation' |
| 46 | + print '-------------------------------------------------------------------' |
| 47 | + msiexec /i $MSI_PKG ALLUSERS=1 /L*V install.txt |
| 48 | + check-local-machine-install |
| 49 | + check-version-match $VERSION $PER_MACHINE_INSTALL_DIR |
| 50 | + winget list nushell --accept-source-agreements |
| 51 | +} |
| 52 | + |
| 53 | +export def test-winget-per-user-install [] { |
| 54 | + winget uninstall nushell | complete |
| 55 | + print $'(char nl)Using winget to test MSI (ansi g)user scope(ansi reset) installation' |
| 56 | + print '-------------------------------------------------------------------' |
| 57 | + winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope user |
| 58 | + check-user-install $PER_USER_INSTALL_DIR |
| 59 | + check-version-match $PREV_VERSION $PER_USER_INSTALL_DIR |
| 60 | + winget list nushell --accept-source-agreements |
| 61 | +} |
| 62 | + |
| 63 | +export def test-winget-per-user-upgrade [] { |
| 64 | + print $'(char nl)Using winget to test MSI (ansi g)user scope(ansi reset) upgrade' |
| 65 | + print '-------------------------------------------------------------------' |
| 66 | + winget install --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS --scope user |
| 67 | + check-user-install $PER_USER_INSTALL_DIR |
| 68 | + check-version-match $LAST_VERSION $PER_USER_INSTALL_DIR |
| 69 | + winget list nushell --accept-source-agreements |
| 70 | +} |
| 71 | + |
| 72 | +export def test-winget-per-machine-install [] { |
| 73 | + winget uninstall nushell | complete |
| 74 | + print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) installation' |
| 75 | + print '-------------------------------------------------------------------' |
| 76 | + winget install --manifest $'manifests\n\Nushell\Nushell\($PREV_VERSION)\' ...$WINGET_ARGS --scope machine |
| 77 | + check-local-machine-install |
| 78 | + check-version-match $PREV_VERSION $PER_MACHINE_INSTALL_DIR |
| 79 | + winget list nushell --accept-source-agreements |
| 80 | +} |
| 81 | + |
| 82 | +export def test-winget-per-machine-upgrade [] { |
| 83 | + print $'(char nl)Using winget to test MSI (ansi g)machine scope(ansi reset) upgrade' |
| 84 | + print '-------------------------------------------------------------------' |
| 85 | + winget install --manifest $'manifests\n\Nushell\Nushell\($LAST_VERSION)\' ...$WINGET_ARGS --scope machine |
| 86 | + check-local-machine-install |
| 87 | + check-version-match $LAST_VERSION $PER_MACHINE_INSTALL_DIR |
| 88 | + winget list nushell --accept-source-agreements |
| 89 | +} |
0 commit comments