-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathInstall.ps1
More file actions
61 lines (48 loc) · 1.66 KB
/
Copy pathInstall.ps1
File metadata and controls
61 lines (48 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$manPath = Get-ChildItem -recurse $PSScriptRoot/../module -include *.psd1 | Select-Object -first 1
$man = Test-ModuleManifest $manPath
$name = $man.Name
[string]$version = $man.Version
$moduleSourceDir = "$PSScriptRoot/$name"
$moduleDir = "~/documents/WindowsPowerShell/Modules/$name/$version/"
[string]$rootDir = Resolve-Path $PSSCriptRoot/..
$InstallDirectory = $moduleDir
if ('' -eq $InstallDirectory)
{
$personalModules = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPowerShell\Modules\
if (($env:PSModulePath -split ';') -notcontains $personalModules)
{
Write-Warning "$personalModules is not in `$env:PSModulePath"
}
if (!(Test-Path $personalModules))
{
Write-Error "$personalModules does not exist"
}
$InstallDirectory = Join-Path -Path $personalModules -ChildPath PSParallel
}
if(-not (Test-Path $InstallDirectory))
{
$null = mkdir $InstallDirectory
}
@(
'module\PSParallel.psd1'
'src\PsParallel\bin\Release\PSParallel.dll'
).Foreach{Copy-Item "$rootdir\$_" -Destination $InstallDirectory }
$lang = @('en-us')
$lang.Foreach{
$lang = $_
$langDir = "$InstallDirectory\$lang"
if(-not (Test-Path $langDir))
{
$null = MkDir $langDir
}
@(
'PSParallel.dll-Help.xml'
'about_PSParallel.Help.txt'
).Foreach{Copy-Item "$rootDir\module\$lang\$_" -Destination $langDir}
}
Get-ChildItem -Recurse -Path $InstallDirectory
$cert =Get-ChildItem cert:\CurrentUser\My -CodeSigningCert
if($cert)
{
Get-ChildItem -File $InstallDirectory -Include *.dll,*.psd1 -Recurse | Set-AuthenticodeSignature -Certificate $cert -TimestampServer http://timestamp.verisign.com/scripts/timstamp.dll
}