-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_choco.ps1
68 lines (54 loc) · 1.71 KB
/
install_choco.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
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
#############################################################
# Set development environment on Linux/macOS/Cygwin quickly.
# Author: Maririn312 <[email protected]>
# URL: https://github.com/maririn312/dotfiles
#############################################################
# Packages
$packages = (
"chocholatey",
# Utilities
"7zip", "clipx", "everything", "putty",
"totalcommander", "wox", "ccleaner",
"git", "tortoisegit", "fork",
"fzf", "peco", "ag", "fd", "ripgrep",
# Editor
"emacs", "vscode",
# Web browser
"googlechrome", # "firefox",
# Screencast
"licecap", "carnac",
# Misc
# "cygwin", "cyg-get",
# "golang", "python", "ruby", "nodejs",
# "jdk8", "jre8", "eclipse",
"sysinternals", "dependecywalker"
);
function Test-Administrator {
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
function check {
# check admin rights
if (-Not (Test-Administrator)) {
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
exit 1
}
# check if choco exists
if (-Not (Get-Command 'choco' -errorAction SilentlyContinue)) {
Write-Host "`n-> Installing Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
}
function install {
foreach ($p in $packages) {
Write-Host "`n-> Installing $p..."
choco upgrade ${p} -y
}
RefreshEnv
}
function main {
check
install
}
main