[U] Fix pwsh.install.ps1
This commit is contained in:
+36
-36
@@ -1,41 +1,39 @@
|
|||||||
#Requires -RunAsAdministrator
|
# # Install chocolatey
|
||||||
|
# if (Get-Command choco -errorAction SilentlyContinue)
|
||||||
|
# {
|
||||||
|
# echo "Choco exists"
|
||||||
|
# }
|
||||||
|
# else
|
||||||
|
# {
|
||||||
|
# echo "Installing choco..."
|
||||||
|
# Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
# [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
# }
|
||||||
|
|
||||||
# Install chocolatey
|
# function install-cmd($cmd, $pack)
|
||||||
if (Get-Command choco -errorAction SilentlyContinue)
|
# {
|
||||||
{
|
# if (!$pack) { $pack = $cmd }
|
||||||
echo "Choco exists"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Installing choco..."
|
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
||||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
||||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
||||||
}
|
|
||||||
|
|
||||||
function install-cmd($cmd, $pack)
|
# if (-Not (Get-Command $cmd -errorAction SilentlyContinue))
|
||||||
{
|
# {
|
||||||
if (!$pack) { $pack = $cmd }
|
# echo "$cmd doesn't exist, installing $pack..."
|
||||||
|
# choco install $pack -y
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
if (-Not (Get-Command $cmd -errorAction SilentlyContinue))
|
# function install-module-safe($module)
|
||||||
{
|
# {
|
||||||
echo "$cmd doesn't exist, installing $pack..."
|
# if (!(Get-Module -ListAvailable -Name $module)) {
|
||||||
choco install $pack -y
|
# Install-Module $module
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
function install-module-safe($module)
|
# # Install gsudo
|
||||||
{
|
# install-cmd gsudo
|
||||||
if (!(Get-Module -ListAvailable -Name $module)) {
|
# install-cmd git
|
||||||
Install-Module $module
|
# install-cmd nano
|
||||||
}
|
# install-module-safe PSColor
|
||||||
}
|
|
||||||
|
|
||||||
# Install gsudo
|
|
||||||
install-cmd gsudo
|
|
||||||
install-cmd git
|
|
||||||
install-cmd nano
|
|
||||||
install-module-safe PSColor
|
|
||||||
|
|
||||||
# ln -s
|
# ln -s
|
||||||
function ln-s ($target, $link) {
|
function ln-s ($target, $link) {
|
||||||
@@ -44,5 +42,7 @@ function ln-s ($target, $link) {
|
|||||||
|
|
||||||
# Install
|
# Install
|
||||||
$docs = [Environment]::GetFolderPath("MyDocuments")
|
$docs = [Environment]::GetFolderPath("MyDocuments")
|
||||||
ln-s "~\zshrc\powershell.ps1" "$docs\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
|
rm "$docs\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
|
||||||
ln-s "~\zshrc\powershell.ps1" "$docs\PowerShell\Microsoft.PowerShell_profile.ps1"
|
ln-s "$HOME\zshrc\powershell.ps1" "$docs\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
|
||||||
|
rm "$docs\PowerShell\Microsoft.PowerShell_profile.ps1"
|
||||||
|
ln-s "$HOME\zshrc\powershell.ps1" "$docs\PowerShell\Microsoft.PowerShell_profile.ps1"
|
||||||
Reference in New Issue
Block a user