-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_git.ps1
64 lines (53 loc) · 2.18 KB
/
add_git.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
function Write-Log {
param (
$message
)
$formattedTime = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
Write-Host "$formattedTime init_vm: $message"
}
$BUILD_DIRECTORY="C:\BuildArtifacts"
$SETTINGS_FILE="$BUILD_DIRECTORY\bash_settings.inf"
# Git Bash
$GitVersion="2.47.0"
$GitBash_INSTALLER_FILE="Git-${GitVersion}-64-bit.exe"
$GitBash_DOWNLOAD_URL="https://github.com/git-for-windows/git/releases/download/v${GitVersion}.windows.1/$GitBash_INSTALLER_FILE"
$GitBash_INSTALL_ARGS="/NORESTART /VERYSILENT /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /LOG=$BUILD_DIRECTORY\git-for-windows.log /LOADINF=$SETTINGS_FILE /SUPPRESSMSGBOXES /ALLUSERS"
Write-Log "Creating GitBash Settings file"
"[Setup]
Lang=default
Dir=C:\Program Files\Git
Group=Git
NoIcons=0
SetupType=compact
Components=icons,icons\desktop,ext,ext\shellhere,ext\guihere,gitlfs,assoc,assoc_sh
Tasks=
EditorOption=VIM
CustomEditorPath=
DefaultBranchOption=main
PathOption=Cmd
SSHOption=OpenSSH
TortoiseOption=false
CURLOption=OpenSSL
CRLFOption=CRLFAlways
BashTerminalOption=MinTTY
GitPullBehaviorOption=Merge
UseCredentialManager=Enabled
PerformanceTweaksFSCache=Enabled
EnableSymlinks=Disabled
EnableBuiltinInteractiveAdd=Disabled
PrivilegesRequiredOverridesAllowed=commandline
EnablePseudoConsoleSupport=Disabled
EnableFSMonitor=Disabled" | Out-File -FilePath $SETTINGS_FILE -Force
Write-Log "Downloading Git Bash"
Invoke-WebRequest -Uri $GitBash_DOWNLOAD_URL -UseBasicParsing -OutFile "$BUILD_DIRECTORY\$GitBash_INSTALLER_FILE"
Write-Log "Installing Git Bash"
Start-Process "$BUILD_DIRECTORY\$GitBash_INSTALLER_FILE" -ArgumentList $GitBash_INSTALL_ARGS -Wait
# GitHub Desktop
$GitHub_INSTALLER_FILE="GitHubDesktopSetup-x64.msi"
$GitHub_DOWNLOAD_URL="https://central.github.com/deployments/desktop/desktop/latest/win32?format=msi"
$GitHub_INSTALL_ARGS="/I $BUILD_DIRECTORY\$GitHub_INSTALLER_FILE /qn /norestart"
Write-Log "Downloading GitHub Desktop Deployment Tool"
Invoke-WebRequest -Uri "$GitHub_DOWNLOAD_URL" -OutFile "$BUILD_DIRECTORY\$GitHub_INSTALLER_FILE"
Write-Log "Installing Github Desktop Deployment Tool"
Start-Process msiexec.exe -Wait -ArgumentList "$GitHub_INSTALL_ARGS"
Write-Log "add_git script complete."