diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-05-29 13:54:30 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-05-29 13:54:30 +0200 |
| commit | d14671ef8f80b440454adaa88207361295daa2b8 (patch) | |
| tree | 6227955077a6d62bc21d67a8ef38515a6d885f22 /.config/powershell/bootstrap.ps1 | |
| parent | 98ce465cb73d9c1cd538985ef7bc0e54a95093fe (diff) | |
| download | dotfiles-d14671ef8f80b440454adaa88207361295daa2b8.tar.gz dotfiles-d14671ef8f80b440454adaa88207361295daa2b8.zip | |
Testing
Diffstat (limited to '.config/powershell/bootstrap.ps1')
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 39dab8f..93c981f 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -10,6 +10,26 @@ $oldUsername = $env:USERNAME $userName = Get-WmiObject win32_userAccount -Filter "Name='$oldUsername'" $result = $userName.Rename($newUsername) + +# Install Chocolatey +Write-Host "Installing Chocolatey" +Write-Host "----------------------------------------" +Set-ExecutionPolicy Bypass -Scope Process -Force +[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 +Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + +# Install Applications +Write-Host "Installing Applications" +Write-Host "----------------------------------------" +choco install git -y +choco install firefox -y +choco install nomachine -y +choco install ripgrep -y +choco install fd -y +choco install sudo -y +choco install win32yank -y +choco install openssh -y + # Set alias for git without work tree function git_without_work_tree { if (Test-Path -Path ".git") { @@ -26,6 +46,7 @@ function git_without_work_tree { & git @args } } + Set-Alias git git_without_work_tree # Add .gitignore entries @@ -121,20 +142,30 @@ if (-not (Test-NVMInstalled)) { Write-Host "Configuring WSL" wsl --install -d Ubuntu -# Install Chocolatey -Write-Host "Installing Chocolatey" -Write-Host "----------------------------------------" -Set-ExecutionPolicy Bypass -Scope Process -Force -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 -Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) +# Function to install SSH +function install_ssh { + Write-Host "Setting Up SSH" + Start-Service ssh-agent + Start-Service sshd + Set-Service -Name ssh-agent -StartupType 'Automatic' + Set-Service -Name sshd -StartupType 'Automatic' + + #Generate SSH key if not exists + if (-not (Test-Path -Path "$env:USERPROFILE\.ssh\id_rsa.pub")) { + ssh-keygen -t rsa -b 4096 -C "$newUsername@$(hostname)" -f "$env:USERPROFILE\.ssh\id_rsa" -N "" + } -# Install Applications -Write-Host "Installing Applications" -Write-Host "----------------------------------------" -choco install ripgrep -y -choco install fd -y -choco install sudo -y -choco install win32yank -y + # Start ssh-agent and add key + eval $(ssh-agent -s) + ssh-add "$env:USERPROFILE\.ssh\id_rsa" + + # Display the SSH key + $sshKey = Get-Content "$env:USERPROFILE\.ssh\id_rsa.pub" + Write-Host "Add the following SSH key to your GitHub account:" + Write-Host $sshKey +} + +install_ssh # Configure Neovim Write-Host "Configuring Neovim" |
