diff --git a/README.md b/README.md index 01dc81a..50a0d44 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,8 @@ My zshrc ```sh /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Hykilpikonna/zshrc/HEAD/ubuntu_setup.sh)" ``` + +# Powershell +```powershell +Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Hykilpikonna/zshrc/HEAD/pwsh.install.ps1')) +``` \ No newline at end of file diff --git a/powershell.ps1 b/powershell.ps1 index cdbffd1..d024d44 100644 --- a/powershell.ps1 +++ b/powershell.ps1 @@ -8,13 +8,6 @@ function ln-s ($target, $link) { New-Item -Path $link -ItemType SymbolicLink -Value $target } -# First time setup -function setup-powershell-profile { - $docs = [Environment]::GetFolderPath("MyDocuments") - ln-s "~\zshrc\powershell.ps1" "$docs\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" - ln-s "~\zshrc\powershell.ps1" "$docs\PowerShell\Microsoft.PowerShell_profile.ps1" -} - # Paths $env:path = "$env:path" + ";C:\users\me\appdata\roaming\python\python39\scripts" + diff --git a/pwsh.install.ps1 b/pwsh.install.ps1 new file mode 100644 index 0000000..b0d9580 --- /dev/null +++ b/pwsh.install.ps1 @@ -0,0 +1,48 @@ +#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')) +} + +function install-cmd($cmd, $pack) +{ + if (!$pack) { $pack = $cmd } + + if (-Not (Get-Command $cmd -errorAction SilentlyContinue)) + { + echo "$cmd doesn't exist, installing $pack..." + choco install $pack -y + } +} + +function install-module-safe($module) +{ + if (!(Get-Module -ListAvailable -Name $module)) { + Install-Module $module + } +} + +# Install gsudo +install-cmd gsudo +install-cmd git +install-cmd nano +install-module-safe PSColor + +# ln -s +function ln-s ($target, $link) { + New-Item -Path $link -ItemType SymbolicLink -Value $target +} + +# Install +$docs = [Environment]::GetFolderPath("MyDocuments") +ln-s "~\zshrc\powershell.ps1" "$docs\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" +ln-s "~\zshrc\powershell.ps1" "$docs\PowerShell\Microsoft.PowerShell_profile.ps1" \ No newline at end of file