-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.ps1
57 lines (44 loc) · 1.16 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Windows Setup Script For Powershell
# ===================================
if ($ams_installed) {
echo "AMS is already installed!"
exit
}
$confirm=Read-Host "Install at $PSScriptRoot ? [Y/N]"
if($confirm -eq "N") {
echo "Aborting install..."
exit
} elseif($confirm -eq "Y") {
echo "Proceeding with installation..."
} else {
echo "Please supply a valid answer."
exit
}
echo "Searching for profile..."
$profile_exists = Test-path $profile
# Create Profile If It Does not Exist
if ($profile_exists -ne $true) {
echo "No profile found. Creatin new one..."
New-item -type file -force $profile
echo "Updating start-up script..."
$profile_text = "New-Alias ams "+$PSScriptRoot+"\src\powershell_wrapper.ps1"
} else {
# Read Old Profile
$profile_text = cat $profile
# Append Wrapper Script
echo "Updating start-up script..."
$profile_text += "
New-Alias ams "+$PSScriptRoot+"\src\powershell_wrapper.ps1
"
$profile_text += '$ams_installed = $true'
}
# Write New Profile
echo "Saving to Disk..."
echo $profile_text > $profile
# Update Current Session
New-Alias ams $PSScriptRoot\src\powershell_wrapper.ps1
echo "
===========
|| DONE! ||
===========
"