more vagrant stuff

This commit is contained in:
Dax T. Games 2023-03-16 14:32:46 -07:00
parent f318bcc1b5
commit eb2444d04a
3 changed files with 18 additions and 141 deletions

133
Vagrantfile vendored
View File

@ -1,135 +1,3 @@
# $script_cmder = <<-SCRIPT
# choco install -y --force 7zip 7zip.install
# choco install -y --force cmder
# SCRIPT
#
# $script_cmderdev = <<-SCRIPT
# $env:path = "$env:path;c:/tools/cmder/vendor/git-for-windows/cmd"
# c:
# cd /Users/Vagrant
# git clone https://github.com/cmderdev/cmder cmderdev
# TAKEOWN /F c:/Users/vagrant/cmderdev /R /D y /s localhost /u vagrant /p vagrant
# cd cmderdev
# git remote add upstream https://github.com/cmderdev/cmder
# git pull upstream master
#
# # cmd.exe "/K" '"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat" && powershell -command "& ''c:/Users/Vagrant/cmderdev/scripts/build.ps1'' -verbose -compile" && exit'
# # copy c:/Users/Vagrant/cmderdev/launcher/x64/release/cmder.exe c:/Users/Vagrant/cmderdev
# # cmd.exe "/K" '"C:/Program Files (x86)/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat" && powershell -noexit -command "& ''build.ps1 -verbose -compile''"'
#
# cd scripts
# ./build.ps1 -verbose
#
# copy C:/Tools/Cmder/Cmder.exe C:/Users/Vagrant/cmderdev
#
# # tabby
# setx cmder_root '%userprofile%/cmderdev'
#
# # VSCode
# $VSCodeUserSettings = "$env:APPDATA/Code/User"
# $VSCodeSettings = "$VSCodeUserSettings/settings.json";
# $VSCodeSettingsNew = $VSCodeSettings.replace('.json', '-new.json')
#
# if (test-path $VSCodeSettings) {
# $data = get-content -path $VSCodeSettings -ErrorAction silentlycontinue | out-string | ConvertFrom-Json
# }
# else {
# New-Item -ItemType directory $VSCodeUserSettings -force
# $data = @{}
# }
#
# write-host $data
#
# $data | Add-Member -force -Name 'terminal.integrated.defaultProfile.windows' -MemberType NoteProperty -Value "Cmder"
#
# if ($null -eq $data.'terminal.integrated.profiles.windows') {
# write-host "Adding 'terminal.integrated.profiles.windows'..."
# $data | Add-Member -force -Name 'terminal.integrated.profiles.windows' -MemberType NoteProperty -Value @{}
# }
#
# write-host "Adding 'terminal.integrated.profiles.windows.Cmder' profile..."
# $data.'terminal.integrated.profiles.windows'.'Cmder' = @{
# "name" = "Cmder";
# "path" = @(
# "`${env:windir}/Sysnative/cmd.exe";
# "`${env:windir}/System32/cmd.exe";
# );
# "args" = @(
# "/k";
# "`${env:USERPROFILE}/cmderdev/vendor/bin/vscode_init.cmd");
# "icon" = "terminal-cmd";
# "color" = "terminal.ansiGreen";
# };
#
# $data | ConvertTo-Json -depth 100 | set-content $VSCodeSettings
#
# # Windows Terminal
# start-process wt.exe
# sleep 5
# kill (get-process windowsterminal).id
# $windowsTerminalFolder = (dir "C:/Users/vagrant/AppData/Local/Packages/Microsoft.WindowsTerminal_*").name
# $windowsTerminalPath = 'C:/Users/vagrant/AppData/Local/Packages/' + $windowsTerminalFolder
# $windowsTerminalSettings = $windowsTerminalPath + '/localState/settings.json'
# $windowsTerminalSettingsNew = $windowsTerminalPath + '/localState/settings-new.json'
# $json = get-content $windowsTerminalSettings | ConvertFrom-Json
# $json.defaultProfile="{00000000-0000-0000-ba54-000000000132}"
#
# $cmderFound = $false
# $cmderAsAdminFound = $false
#
# foreach ($profile in $json.profiles.list) {
# if ($profile.Name -eq "Cmder") {
# $cmderFound = $true
# }
# elseIf ($profile.Name -eq "Cmder as Admin") {
# $cmderAsAdminFound = $true
# }
# }
#
# if (-not $cmderFound) {
# write-host "Adding 'Cmder' to Windows Terminal..."
#
# $json.profiles.list += @{
# commandline="cmd.exe /k `"%USERPROFILE%/cmderdev/vendor/init.bat`"";
# startingDirectory="%USERPROFILE%/cmderdev";
# icon="%USERPROFILE%/cmderdev/icons/cmder.ico";
# closeOnExit="graceful";
# guid="{00000000-0000-0000-ba54-000000000132}";
# hidden=$false;
# name="Cmder"
# }
# }
#
# if (-not $cmderAsAdminFound) {
# write-host "Adding 'Cmder as Admin' to Windows Terminal..."
#
# $json.profiles.list += @{
# commandline="cmd.exe /k `"%USERPROFILE%/cmderdev/vendor/init.bat`"";
# startingDirectory="%USERPROFILE%/cmderdev";
# icon="%USERPROFILE%/cmderdev/icons/cmder_red.ico";
# closeOnExit="graceful";
# guid="{00000000-0000-0000-ba54-000000000133}";
# hidden=$false;
# elevate=$true;
# name="Cmder as Admin"
# }
# }
#
# $json | ConvertTo-Json -depth 100 | set-content $windowsTerminalSettings
#
# # C:\Users\vagrant\AppData\Roaming\Hyper
# # // shell: '',
# # shell: 'cmd.exe',
# # // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
# # // by default `['--login']` will be used
# # // shellArgs: ['--login'],
# # shellArgs: ['/k', 'C:\\users\\vagrant\\cmderdev\\vendor\\init.bat'],
#
# C:/Users/Vagrant/bin/set-shortcut.ps1 -SourceExe "C:\\tools\\Cmder\\Cmder.exe" -DestinationPath "C:\\Users\\vagrant\\Desktop\\Cmder.lnk" -WorkingDirectory C:\\tools\\Cmder
# C:/Users/vagrant/bin/set-shortcut.ps1 -SourceExe "C:\\Users\\vagrant\\cmderdev\\Cmder.exe" -DestinationPath "C:\\Users\\vagrant\\Desktop\\Cmderdev.lnk" -WorkingDirectory C:\\Users\\vagrant\\cmderdev
#
# SCRIPT
Vagrant.configure("2") do |config|
required_plugins = %w( vagrant-vbguest )
required_plugins.each do |plugin|
@ -192,4 +60,5 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", path: './scripts/vagrant/add-cmder.ps1'
config.vm.provision "shell", path: './vendor/bin/add-vscodeprofile.ps1'
config.vm.provision "shell", path: './vendor/bin/add-windowsterminalprofiles.ps1'
config.vm.provision "shell", path: './vendor/bin/add-cmdertodesktop.ps1'
end

View File

@ -26,16 +26,8 @@ cd scripts
copy C:/Tools/Cmder/Cmder.exe $env:userprofile/cmderdev
$env:cmder_root = "C:/tools/cmder"
write-host "Creating '${env:USERPROFILE}/Desktop/Cmder.lnk'..."
start-process -NoNewWindow -filePath "$env:userprofile/bin/set-shortcut.ps1" -ArgumentList "-sourceexe `"$env:cmder_root\\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\\Desktop\\Cmder.lnk`" -WorkingDirectory `"${env:USERPROFILE}`""
$env:cmder_root = "${env:USERPROFILE}\\cmderdev"
write-host "Creating '${env:USERPROFILE}\\Desktop\\Cmderdev.lnk'..."
start-process -NoNewWindow -filePath "$env:userprofile\\bin\\set-shortcut.ps1" -ArgumentList "-sourceexe `"${env:cmder_root}\\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\\Desktop\\Cmderdev.lnk`" -WorkingDirectory `"${env:cmder_root}`""
# tabby
setx cmder_root "$env:cmder_root"
setx cmder_root "${env:userprofile}\cmderdev"
# C:\Users\vagrant\AppData\Roaming\Hyper
# // shell: '',

16
vendor/bin/add-cmdertodesktop.ps1 vendored Normal file
View File

@ -0,0 +1,16 @@
if (test-path "${env:USERPROFILE}\cmder") {
$env:cmder_root = "${env:USERPROFILE}\cmder"
write-host "Creating '${env:USERPROFILE}\Desktop\Cmder.lnk'..."
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"$env:cmder_root\vendor\bin\set-shortcut.ps1`" -sourceexe `"$env:cmder_root\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmder.lnk`" -WorkingDirectory `"${env:USERPROFILE}`""
} elseif (test-path "C:\tools\cmder") {
$env:cmder_root = "C:\tools\cmder"
write-host "Creating '${env:USERPROFILE}\Desktop\Cmder.lnk'..."
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"$env:cmder_root\vendor\bin\set-shortcut.ps1`" -sourceexe `"$env:cmder_root\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmder.lnk`" -WorkingDirectory `"${env:USERPROFILE}`""
}
if (test-path "${env:USERPROFILE}\cmderdev") {
$env:cmder_root = "${env:USERPROFILE}\cmderdev"
write-host "Creating '${env:USERPROFILE}\Desktop\Cmderdev.lnk'..."
start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"$env:cmder_root\vendor\bin\set-shortcut.ps1`" -sourceexe `"${env:cmder_root}\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmderdev.lnk`" -WorkingDirectory `"${env:cmder_root}`""
}