fix file/dir checks and remove vim
This commit is contained in:
		
							
								
								
									
										80
									
								
								install.ps1
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								install.ps1
									
									
									
									
									
								
							@@ -8,7 +8,6 @@
 | 
			
		||||
# }
 | 
			
		||||
 | 
			
		||||
# Disable UAC
 | 
			
		||||
 | 
			
		||||
$uac_reg_value = Get-ItemPropertyValue -Path Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA
 | 
			
		||||
 | 
			
		||||
if(-not $uac_reg_value -eq 0)
 | 
			
		||||
@@ -61,7 +60,6 @@ else {
 | 
			
		||||
    Write-Host "DEV_PATH=$env:DEV_PATH"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# NC_PATH --Use this per-machine
 | 
			
		||||
if(-not $env:NC_PATH)
 | 
			
		||||
{
 | 
			
		||||
@@ -71,22 +69,51 @@ if(-not $env:NC_PATH)
 | 
			
		||||
    Write-Host "NC_PATH=$env:NC_PATH"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# User Profile
 | 
			
		||||
# User Profile and App Data Dirs
 | 
			
		||||
Write-Host "User Profile Directory: $($env:USERPROFILE)"
 | 
			
		||||
 | 
			
		||||
# VS Code Directory
 | 
			
		||||
$local_app_data = $env:LOCALAPPDATA
 | 
			
		||||
$app_data = $env:APPDATA
 | 
			
		||||
New-Item -ItemType Directory -Force -Path "$($app_data)\Code\User"
 | 
			
		||||
Write-Host "VS Code User Directory: $($app_data)\Code\User"
 | 
			
		||||
 | 
			
		||||
# VS Code Directories
 | 
			
		||||
$vscode_installed = Test-Path -Path "$local_app_data\Programs\Microsoft VS Code\Code.exe"
 | 
			
		||||
if(-not $vscode_installed)
 | 
			
		||||
{
 | 
			
		||||
    New-Item -ItemType Directory -Force -Path "$($app_data)\Code\User"
 | 
			
		||||
    Write-Host "VS Code User Directory: $($app_data)\Code\User"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$vscode_user_settings_path = "$($app_data)\Code\User\settings.json"
 | 
			
		||||
Write-Host "VS Code User Settings Path: $($vscode_user_settings_path)"
 | 
			
		||||
 | 
			
		||||
# Cmder Config Directory
 | 
			
		||||
# Cmder Config Directories
 | 
			
		||||
$cmder_root = "$($env:USERPROFILE)\Cmder"
 | 
			
		||||
New-Item -ItemType Directory -Force -Path "$($cmder_root)\config"
 | 
			
		||||
Write-Host "Cmder Config Directory: $($cmder_root)\config"
 | 
			
		||||
$cmder_installed = Test-Path -Path "$cmder_root\Cmder.exe"
 | 
			
		||||
Write-Host "Cmder Installed: $cmder_installed"
 | 
			
		||||
 | 
			
		||||
# DL and Extarct Cmder Directory
 | 
			
		||||
if(-not $cmder_installed)
 | 
			
		||||
{
 | 
			
		||||
    $cmder_version = Read-Host -Prompt 'Input Latest Cmder Release'
 | 
			
		||||
    $cmder_url = "https://github.com/cmderdev/cmder/releases/download/$($cmder_version)/cmder_mini.zip"
 | 
			
		||||
    $download_zip_file = "$($env:USERPROFILE)\Downloads" + $(Split-Path -Path $url -Leaf)
 | 
			
		||||
    $extract_path = $cmder_root
 | 
			
		||||
    Invoke-WebRequest -Uri $cmder_url -OutFile $download_zip_file
 | 
			
		||||
    $extract_shell = New-Object -ComObject Shell.Application
 | 
			
		||||
    $extract_files = $extract_shell.Namespace($download_zip_file).Items()
 | 
			
		||||
    $extract_shell.Namespace($extract_path).CopyHere($extract_files)
 | 
			
		||||
    Start-Process $extract_path
 | 
			
		||||
} else {
 | 
			
		||||
    Write-Host "Cmder is installed"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Ensure Cmder Dirs
 | 
			
		||||
if(-not $cmder_installed)
 | 
			
		||||
{
 | 
			
		||||
    New-Item -ItemType Directory -Force -Path "$($cmder_root)\config"
 | 
			
		||||
    Write-Host "Cmder Config Directory: $($cmder_root)\config"
 | 
			
		||||
} else {
 | 
			
		||||
    Write-Host "Cmder Config Directory Exists"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$cmder_user_conemu_xml_path = "$($cmder_root)\config\user_ConEmu.xml"
 | 
			
		||||
Write-Host "Cmder ConEmu Path: $($cmder_user_conemu_xml_path)"
 | 
			
		||||
@@ -100,13 +127,12 @@ Write-Host "Cmder CMD Aliases Path: $($cmder_user_aliases_cmd_path)"
 | 
			
		||||
$cmder_user_profile_ps_path = "$($cmder_root)\config\user_profile.ps1"
 | 
			
		||||
Write-Host "Cmder PowerShell Profile Path: $($cmder_user_profile_ps_path)"
 | 
			
		||||
 | 
			
		||||
# Neovim Config Directory
 | 
			
		||||
$local_app_data = $env:LOCALAPPDATA
 | 
			
		||||
New-Item -ItemType Directory -Force -Path "$($local_app_data)\nvim"
 | 
			
		||||
Write-Host "Neovim Init Directory: $($local_app_data)\nvim"
 | 
			
		||||
# # Neovim Config Directory
 | 
			
		||||
# New-Item -ItemType Directory -Force -Path "$($local_app_data)\nvim"
 | 
			
		||||
# Write-Host "Neovim Init Directory: $($local_app_data)\nvim"
 | 
			
		||||
 | 
			
		||||
$neovim_init_path = "$($local_app_data)\nvim\init.vim"
 | 
			
		||||
Write-Host "Neovim Init Path: $($neovim_init_path)"
 | 
			
		||||
# $neovim_init_path = "$($local_app_data)\nvim\init.vim"
 | 
			
		||||
# Write-Host "Neovim Init Path: $($neovim_init_path)"
 | 
			
		||||
 | 
			
		||||
# Cmder DOSKEY Aliases
 | 
			
		||||
if (-not (Test-Path -Path $cmder_user_aliases_cmd_path)) {
 | 
			
		||||
@@ -157,15 +183,15 @@ if (-not (Test-Path -Path $vscode_user_settings_path)) {
 | 
			
		||||
    Write-Host "VS Code User Settings Exists"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# NeoVim init
 | 
			
		||||
if (-not (Test-Path -Path $neovim_init_path)) {
 | 
			
		||||
    $repo_neovim_init_path = "$($PWD)\vim\init.vim"
 | 
			
		||||
    Write-Host "Repo init.vim: $($repo_neovim_init_path)"
 | 
			
		||||
    New-Item -Path $neovim_init_path -ItemType SymbolicLink -Value $repo_neovim_init_path
 | 
			
		||||
    Get-Item -Path $neovim_init_path
 | 
			
		||||
} else {
 | 
			
		||||
    Write-Host "Neovim Init Path Exists"
 | 
			
		||||
}
 | 
			
		||||
# # NeoVim init
 | 
			
		||||
# if (-not (Test-Path -Path $neovim_init_path)) {
 | 
			
		||||
#     $repo_neovim_init_path = "$($PWD)\vim\init.vim"
 | 
			
		||||
#     Write-Host "Repo init.vim: $($repo_neovim_init_path)"
 | 
			
		||||
#     New-Item -Path $neovim_init_path -ItemType SymbolicLink -Value $repo_neovim_init_path
 | 
			
		||||
#     Get-Item -Path $neovim_init_path
 | 
			
		||||
# } else {
 | 
			
		||||
#     Write-Host "Neovim Init Path Exists"
 | 
			
		||||
# }
 | 
			
		||||
 | 
			
		||||
Write-Host -NoNewline "Be sure to Reboot the Machine. Press any key to continue.."
 | 
			
		||||
Write-Host -NoNewline "Install Complete. Be sure to Reboot the Machine if UAC or DEV Mode was configured. Press any key to continue.."
 | 
			
		||||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
 | 
			
		||||
		Reference in New Issue
	
	Block a user