Skip to content

Commit

Permalink
feat(install): Run installer.script after installer.file (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 authored Nov 29, 2020
1 parent 547e5ba commit 503df1f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 20 deletions.
32 changes: 26 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
# Changelog

## 0.55-pre4
## [0.55](https://github.com/Ash258/Scoop-Core/milestone/2)

### 0.55-pre5

- **install**
- Remove mutually exclusivity of `installer.script` and `installer.file`
- `script` property is executed after `file`
- Fix `installer.file` exit code from ps1 scripts
- Fix `installer.keep` inconsitency between powershell scripts and executables
- Add changelong to repository
- **autoupdate**: Initial preparation for array support
- **manifests**: Add `changelog` property
- It will be shown on manifest installation/updates
- **scoop-alias**: Add `path` and `edit` subcommands
- **completion**: Correctly support `&&` and `||`
- **scoop-(un)hold**: Support `--global` parameter
- **persist**: Pre-create nested directories
- **autoupdate**: Support base64 for all extraction types
- Small code cleanup and refactorings

### 0.55-pre4

- **update**: Ignore merge commits in update log
- `scoop --version` reports PowerShell version
- **depends**: Correctly detect globally installed dependencies
- **buckets**: Indicate successfull bucket removal
- **buckets**: Indicate inability of bucket removal

## 0.55-pre3
### 0.55-pre3

- Sync with upstream/master

## 0.55-pre2
### 0.55-pre2

- `scoop search` reimplemented
- Fix regression from `--help` addition
- **decompress**: Fix 7zip requirements detection
- **autoupdate**: Added `$headVersion` and `$tailVersion` substitutes

## 0.55.1-pre
### 0.55.1-pre

- Allow `-h` and `--help` parameters for all scoop commands
- Lots of refactorings

## 0.55-pre - Abort deprecation 🎉
### 0.55-pre - Abort deprecation 🎉

- `abort` funcion completely eliminated
- Multiple manifest installation is not broken in case of one failure. (for example)
Expand All @@ -47,7 +67,7 @@

- Fosshub downloads hotfix

## 0.5 - Fork initializaiton
## [0.5 - Fork initializaiton](https://github.com/Ash258/Scoop-Core/milestone/1)

- Licensed under `GPL-3.0-only`

Expand Down
22 changes: 13 additions & 9 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -735,17 +735,18 @@ function run_installer($fname, $manifest, $architecture, $dir, $global) {
# MSI or other installer
$msi = msi $manifest $architecture
$installer = installer $manifest $architecture
if ($installer.script) {
Write-UserMessage -Message 'Running installer script...' -Output:$false
Invoke-Expression (@($installer.script) -join "`r`n")
return
}

if ($msi) {
install_msi $fname $dir $msi
} elseif ($installer) {
install_prog $fname $dir $installer $global
}

# Run install.script after installer.file
if ($installer.script) {
Write-UserMessage -Message 'Running installer script...' -Output:$false
Invoke-Expression (@($installer.script) -join "`r`n")
}
}

# deprecated (see also msi_installed)
Expand Down Expand Up @@ -795,17 +796,20 @@ function install_prog($fname, $dir, $installer, $global) {
$arg = @(args $installer.args $dir $global)

if ($prog.EndsWith('.ps1')) {
Write-UserMessage -Message "Running installer file '$prog'" -Output:$false
& $prog @arg
# TODO: Handle $LASTEXITCODE
if ($LASTEXITCODE -ne 0) {
throw [ScoopException] "Installation failed with exit code $LASTEXITCODE"
}
} else {
$installed = Invoke-ExternalCommand $prog $arg -Activity 'Running installer...'
if (!$installed) {
throw [ScoopException] "Installation aborted. You might need to run 'scoop uninstall $app' before trying again." # TerminatingError thrown
}

# Don't remove installer if "keep" flag is set to true
if ($installer.keep -ne 'true') { Remove-Item $prog }
}

# Do not remove installer if "keep" flag is set to true
if ($installer.keep -ne 'true') { Remove-Item $prog }
}

function run_uninstaller($manifest, $architecture, $dir) {
Expand Down
10 changes: 5 additions & 5 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,16 @@
"type": "string"
},
"args": {
"description": "Specify arguments to be passed to uninstaller file.",
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"script": {
"description": "Specify PowerShell commands required to install application.",
"description": "Specify arguments to be passed to installer file.",
"$ref": "#/definitions/stringOrArrayOfStrings"
},
"keep": {
"description": "Specify the installer file should be kept for future use.",
"type": "boolean"
},
"script": {
"description": "Specify PowerShell commands required to install application. installer.script will be executed after installer.file",
"$ref": "#/definitions/stringOrArrayOfStrings"
}
}
},
Expand Down

0 comments on commit 503df1f

Please sign in to comment.