Last active
August 20, 2024 07:17
-
-
Save goesang/7a0d1bd1e3830246a66ab7e062e0453a to your computer and use it in GitHub Desktop.
개발 도구 설치 스크립트
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Requires -RunAsAdministrator | |
Write-Host "" | |
Write-Host " ___ _ __ __ _ ___ ___ ___ _ " | |
Write-Host " / _ \ | |_ | \/ | _ _ | | | \ / __|/ __| | |" | |
Write-Host "| (_) || ' \ | |\/| || || | | |__ | |) || (__| (__ |_|" | |
Write-Host " \___/ |_||_| |_| |_| \_, | |____||___/ \___|\___| (_)" | |
Write-Host " |__/ 1.0" | |
Write-Host "" | |
Write-Host " Standard Development Tools Management Platform!" | |
Write-Host "" | |
Write-Host " Minimal Install" | |
Write-Host " ---------------" | |
Write-Host " choco, chocolateygui, git.install, 7zip," -NoNewline | |
Write-Host " window10-wsl2-settings" -ForegroundColor magenta | |
Write-Host " nvm," -NoNewline | |
Write-Host " nodejs, npm, jhipster" -ForegroundColor yellow -NoNewline | |
Write-Host " sdkman, open-jdk-8.0.302, maven" -ForegroundColor red | |
Write-Host "" | |
Write-Host " Everything Install(include Minimal)" | |
Write-Host " ------------------" | |
Write-Host " webex, treesizefree, powertoys, jetbrainstoolbox," | |
Write-Host " cascadia-code-nerd-font, poshgit, oh-my-posh,"-NoNewline | |
Write-Host " custom-posh-settings" -ForegroundColor green | |
Write-Host " microsoft-windows-terminal" | |
Write-Host " sourcetree, everything, winscp, notepadplusplus.install" | |
Write-Host "" | |
Write-Host " WSL2 Install" | |
Write-Host " ------------------" | |
Write-Host " window10-wsl2-settings," -ForegroundColor magenta -NoNewline | |
Write-Host " wsl2, podman-desktop,"-NoNewline | |
Write-Host "" | |
Write-Host "" | |
$global:AllSkip = $false | |
$global:MinimalMode = $false | |
Function Magic-Is-Happening { | |
Write-Host "" | |
Write-Host " _ _ _ _ _ " | |
Write-Host " (_) (_) | | (_) | |" | |
Write-Host " _ __ ___ __ _ __ _ _ ___ _ ___ | |__ __ _ _ __ _ __ ___ _ __ _ _ __ __ _ | |" | |
Write-Host " | '_ ` _ \ / _` |/ _` | |/ __| | | / __| | '_ \ / _` | '_ \| '_ \ / _ \ '_ \| | '_ \ / _` | | |" | |
Write-Host " | | | | | | (_| | (_| | | (__ | | \__ \ | | | | (_| | |_) | |_) | __/ | | | | | | | (_| | |_|" | |
Write-Host " |_| |_| |_|\__,_|\__, |_|\___| |_| |___/ |_| |_|\__,_| .__/| .__/ \___|_| |_|_|_| |_|\__, | (_)" | |
Write-Host " __/ | | | | | __/ | " | |
Write-Host " |___/ |_| |_| |___/ " | |
Write-Host "" | |
Write-Host ' Installation is starting!'; | |
Write-Host "" | |
} | |
Function Restart-Please { | |
Write-Host " " | |
Write-Host " _____ _____ _ _ _____ _ _ " | |
Write-Host " | __ \ / ____| | | | | __ \| | | | " | |
Write-Host " | |__) |___ | (___ | |_ __ _ _ __| |_ | |__) | | ___ __ _ ___ ___ | | " | |
Write-Host " | _ // _ \ \___ \| __/ _` | '__| __| | ___/| |/ _ \/ _` / __|/ _ \ | | " | |
Write-Host " | | \ \ __/ ____) | || (_| | | | |_ | | | | __/ (_| \__ \ __/ |_| " | |
Write-Host " |_| \_\___| |_____/ \__\__,_|_| \__| |_| |_|\___|\__,_|___/\___| (_) " | |
Write-Host " " | |
Write-Host " " | |
} | |
Function Insert-Complete { | |
choco feature disable -n allowGlobalConfirmation; | |
Write-Host "" | |
Write-Host " ___ _ _ _ _ _ " | |
Write-Host " |_ _|_ __ ___ ___ _ __| |_ ___ ___ _ __ ___ _ __ | (_) |_ ___ | |" | |
Write-Host " | || '_ \/ __|/ _ \ '__| __| / __/ _ \| '_ ` _ \| '_ \| | | __/ _ \ | |" | |
Write-Host " | || | | \__ \ __/ | | |_ | (_| (_) | | | | | | |_) | | | || __/ | |" | |
Write-Host " |___|_| |_|___/\___|_| \__| \___\___/|_| |_| |_| .__/|_|_|\__\___| |_|" | |
Write-Host " |_| (_)" | |
Write-Host "" | |
Write-Host ' Please restart your computer.'; | |
Write-Host "" | |
Start-Sleep -Seconds 3; | |
Exit; | |
} | |
Function Install-Choco { | |
if(!(test-path C:\ProgramData\chocolatey)){ | |
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')) | |
choco install chocolateygui -y | |
} | |
} | |
Function Confirm-Message($message) { | |
if($global:AllSkip){ | |
return $global:AllSkip; | |
} | |
$confirmation = Read-Host "$message ? [y/n]" | |
$confirmation -eq 'y' | |
} | |
Function Confirm-Skip-All { | |
if (Confirm-Message("Do you agree to skip all?")) { | |
$global:AllSkip = $true | |
} | |
return $global:AllSkip | |
} | |
Function WSL-Settings-Check{ | |
$wslFeature = ((Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux).State -eq 'Enabled'); | |
$virtualMachinePlatform= ((Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform).State -eq 'Enabled'); | |
retrun (wslFeature -and virtualMachinePlatform); | |
} | |
Function Git-Bash-Run($cmd) { | |
if((test-path $env:ProgramFiles\Git)){ | |
Start-Process -Wait $env:ProgramFiles\Git\git-bash.exe -Args '-c "$cmd"'; | |
} | |
} | |
$global:Choice = '' | |
while (!$Choice) | |
{ | |
Write-Host ' 1. Everything, Every where, All at once! Install!'; | |
Write-Host ' 2. Minimal Install.'; | |
Write-Host ' 3. WSL Install.'; | |
Write-Host ' 4. Exit.'; | |
Write-Host ' '; | |
$Choice = Read-Host 'Please select number!' | |
switch ($Choice) | |
{ | |
'1' { #1. Everything, Every where, All at once! Install! | |
if (Confirm-Skip-All) { | |
Magic-Is-Happening; | |
} | |
} | |
'2' { #2. Minimal Install. | |
Confirm-Skip-All; | |
$global:MinimalMode=$true; | |
} | |
'3' { #3. WSL Install. | |
if(!WSL-Settings-Check){ | |
Write-Warning ' You have not turned on WSL features for Windows!'; | |
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart | |
Restart-Please; | |
Write-Warning ' Setup is complete. Please restart and try again!'; | |
Start-Sleep -Seconds 5; | |
Exit; | |
} | |
Install-Choco; | |
choco install wsl2; | |
choco install podman-desktop; | |
Insert-Complete; | |
} | |
'4' { #Exit | |
Write-Host 'Bye Bye~'; | |
Start-Sleep -Seconds 2; | |
Exit | |
} | |
default { | |
Write-Warning 'Please try again & choose 1 - 5 number.'; | |
$Choice = ''; | |
} | |
} | |
} | |
# install start!!! | |
Install-Choco; | |
if ($global:AllSkip) { | |
choco feature enable -n allowGlobalConfirmation; | |
} | |
if(!(test-path $env:ProgramFiles\Git)){ | |
choco install git.install | |
} | |
# sdkman & java & maven 설치 | |
if((!(test-path $env:ProgramFiles\java) -and !(test-path $HOME\.sdkman)) -and (Confirm-Message("Do you agree to install sdkman?"))){ | |
choco install 7zip | |
Git-Bash-Run("ln -s /c/Program\ Files/7-Zip/7z.exe /c/Program\ Files/Git/mingw64/bin/zip.exe"); | |
Git-Bash-Run("curl -s ""https://beta.sdkman.io""|bash"); | |
Git-Bash-Run("source $HOME/.sdkman/bin/sdkman-init.sh"); | |
Git-Bash-Run("sdk install java 8.0.302-open"); | |
Git-Bash-Run("sdk install maven"); | |
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "$HOME\.sdkman\candidates\java\current","Machine"); | |
[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + ";$($env:JAVA_HOME)\bin","Machine"); | |
[System.Environment]::SetEnvironmentVariable("MAVEN_HOME", "$HOME\.sdkman\candidates\maven\current","Machine"); | |
[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + ";$($env:MAVEN_HOME)\bin","Machine"); | |
} | |
# nvm & nodejs & npm 설치 | |
if(!(test-path $env:ProgramFiles\nodejs) -eq !!(test-path $ENV:UserProfile\AppData\Roaming\nvm)){ | |
choco install nvm | |
Git-Bash-Run("nvm install 16.20.0"); | |
Git-Bash-Run("nvm on"); | |
Git-Bash-Run("npm install -g generator-jhipster"); | |
} | |
# wsl2를 위한 세팅 | |
if(Confirm-Message("Do you want to set up to install wsl2?")){ | |
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart | |
} | |
if($global:MinimalMode){ | |
Insert-Complete; | |
} | |
# 각종 유틸리티 설치 | |
if(!(test-path ${env:ProgramFiles(x86)}\Notepad++)){ | |
choco install notepadplusplus.install | |
} | |
if(!(test-path ${env:ProgramFiles(x86)}\winscp)){ | |
choco install winscp | |
} | |
if(!(test-path $env:ProgramFiles\Everything)){ | |
choco install everything | |
} | |
if(!(test-path $ENV:UserProfile\APPDATA/LOCAL/SOURCETREE)){ | |
choco install sourcetree | |
} | |
if(!(test-path $ENV:UserProfile\AppData\Local\JetBrains\Toolbox)){ | |
choco install jetbrainstoolbox | |
} | |
if(!(test-path "$env:ProgramFiles\PowerToys")){ | |
choco install powertoys | |
} | |
if(!(test-path "$env:ProgramFiles\JAM Software\TreeSize Free")){ | |
choco install treesizefree | |
} | |
# posh 설치를 위한 스크립트 | |
choco install microsoft-windows-terminal | |
choco install oh-my-posh | |
if(!(test-path $env:ProgramFiles\Git)){ | |
choco install poshgit | |
} | |
choco install cascadia-code-nerd-font | |
if(!(test-path $ENV:UserProfile\AppData\Local\Programs\oh-my-posh\themes)){ | |
mkdir -p $ENV:UserProfile\AppData\Local\Programs\oh-my-posh\themes | |
curl -o $ENV:UserProfile\AppData\Local\Programs\oh-my-posh\themes/M365Princess.omp.json https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/M365Princess.omp.json | |
Add-Content ~/.bashrc "eval ""`$(oh-my-posh --init --shell bash --config ~/AppData/Local/Programs/oh-my-posh/themes/M365Princess.omp.json)"" " -nonewline | |
} | |
Insert-Complete; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment