-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
41 lines (32 loc) · 935 Bytes
/
install.ps1
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
# Copyright (c) 2023 DMascot
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
$REPOSITORY = "https://github.com/dmascot/tools.git"
$DEST_DIR = [IO.Path]::Combine($env:TEMP, "tools")
function Test-Prerequisites {
$counter = Get-Command "git" -ErrorAction Ignore | Measure-Object
if ( $counter.Count -eq 0 ) { return $false }
return $true
}
function Get-ToolsScripts() {
Write-Output "Cloning tools repository to $DEST_DIR"
git clone $REPOSITORY $DEST_DIR | Out-Null
}
function Install-Tools() {
$SETUP_SCRIPT = [IO.Path]::Combine($DEST_DIR, "setup.ps1")
Set-Location $DEST_DIR
Invoke-Expression $SETUP_SCRIPT
}
function Remove-ToolsScripts {
Set-Location $env:HOMEPATH
Remove-Item -Recurse -Force $DEST_DIR
}
function main() {
if (Test-Prerequisites) {
Get-ToolsScripts
Install-Tools
Remove-ToolsScripts
}
}
main