vagrant, better MSI support

This commit is contained in:
Luke Sampson
2013-07-20 12:07:03 +10:00
parent 4149782248
commit 374191ec1f
4 changed files with 29 additions and 6 deletions
+11
View File
@@ -0,0 +1,11 @@
{
"version": "1.2.4",
"license": "MIT",
"url": "http://files.vagrantup.com/packages/0219bb87725aac28a97c0e924c310cc97831fd9d/Vagrant_1.2.4.msi",
"hash": "sha256:f160bb5474083aa49f17a74d80448c1850f0139c40551565b75a3b6a74b22d2d",
"msi": {
"code": "{BBD54C5B-F7BB-4127-A707-A13A667E3102}",
"args": [ "/qn", "MANUFACTURERDIR=\"$dir\"", "VAGRANTAPPDIR=\"$dir\"", "ALLUSERS=2", "MSIINSTALLPERUSER=1" ]
},
"bin": "bin\\vagrant.bat"
}
+6 -4
View File
@@ -164,7 +164,7 @@ function run_installer($fname, $manifest, $architecture, $dir) {
$installer = installer $manifest $architecture
if($msi -or $installer) {
$exe = $null; $arg = $null; $rmfile = $null; $logfile = $null;
$exe = $null; $arg = $null; $rmfile = $null; $logfile = $null; $continue_exit_codes = $null
if($msi) { # msi
$rmfile = $msifile = "$dir\$(coalesce $msi.file "$fname")"
@@ -175,7 +175,8 @@ function run_installer($fname, $manifest, $architecture, $dir) {
$exe = 'msiexec'
$logfile = "$dir\install.log"
$arg = @("/i `"$msifile`"", '/qb-!', "/norestart", "/lvp `"$logfile`"", "TARGETDIR=`"$dir`"", "INSTALLDIR=`"$dir`"") +
(@($msi.args) | ? { $_ })
@(args $msi.args $dir)
$continue_exit_codes = @{ 3010 = "a restart is required to complete installation" }
} elseif($installer) { # other installer
$rmfile = $exe = "$dir\$(coalesce $installer.exe "$fname")"
if(!(is_in_dir $dir $exe)) {
@@ -184,7 +185,7 @@ function run_installer($fname, $manifest, $architecture, $dir) {
$arg = args $installer.args $dir
}
$installed = run $exe $arg "running installer..."
$installed = run $exe $arg "running installer..." $continue_exit_codes
if(!$installed) {
abort "installation aborted. you might need to run 'scoop uninstall $app' before trying again."
}
@@ -202,8 +203,9 @@ function run_uninstaller($manifest, $architecture, $dir) {
if($msi) {
$code = $msi.code
$exe = "msiexec"; $arg = @("/x $code", '/qb-!');
$exe = "msiexec"; $arg = @("/norestart", "/x $code", '/qb-!');
$continue_exit_codes.1605 = 'not installed, skipping'
$continue_exit_codes.3010 = 'restart required'
} elseif($uninstaller) {
$exe = "$dir\$($uninstaller.exe)"
$arg = args $uninstaller.args
+4 -1
View File
@@ -6,7 +6,10 @@ function current_version($app) {
@(versions $app)[-1]
}
function versions($app) {
sort_versions (gci "$scoopdir\apps\$app" -dir | % { $_.name })
$appdir = "$scoopdir\apps\$app"
if(!(test-path $appdir)) { return @() }
sort_versions (gci $appdir -dir | % { $_.name })
}
function version($ver) {
+8 -1
View File
@@ -5,6 +5,13 @@
# * Will make use of scoop's manifest and download cache so you don't have to
# keep track of the installer file.
# * Passing the -help switch should show the installer's help popup
#
#
# How to silence the UAC prompt:
# http://csi-windows.com/blog/all/27-csi-news-general/335-how-to-silence-the-uac-prompt-for-per-machine-msi-packages-for-non-admins
#
# MSIINSTALLPERUSER
# http://msdn.microsoft.com/en-us/library/windows/desktop/dd408007(v=vs.85).aspx
param($app, $architecture='64bit',[switch]$help)
@@ -33,7 +40,7 @@ if($fname -match '\.msi$') {
$exe = 'msiexec'
$file = resolve-path "$dir\$fname"
$log = "$dir\$($app)_log.txt"
$arg = @("/i `"$file`"", "/qb-!", "/norestart", "ALLUSERS=''", "INSTALLDIR=`"$dir\install_$app`"", "/lvp `"$log`"")
$arg = @("/i `"$file`"", "/qb-!", "/norestart", "ALLUSERS=2", "MSIINSTALLPERUSER=2", "INSTALLDIR=`"$dir\install_$app`"", "/lvp `"$log`"")
if($help) { $arg = '/?' }
$installed = run $exe $arg "testing $fname..."
"installed: $installed"