diff --git a/Vagrantfile b/Vagrantfile index 3eadb80..40e3584 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -58,6 +58,7 @@ Vagrant.configure("2") do |config| config.vm.provision "file", source: "./scripts/vagrant/windows_terminal_settings.json.default", destination: "windows_terminal_settings.json.default" config.vm.provision "file", source: "./scripts/vagrant/windows_terminal_state.json.default", destination: "windows_terminal_state.json.default" + config.vm.provision "file", source: "./vendor/bin/set-shortcut.ps1", destination: "c:\\windows\\set-shortcut.ps1" 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' diff --git a/scripts/vagrant/add-cmder.ps1 b/scripts/vagrant/add-cmder.ps1 index b114188..8ff3785 100644 --- a/scripts/vagrant/add-cmder.ps1 +++ b/scripts/vagrant/add-cmder.ps1 @@ -4,17 +4,17 @@ choco install -y --force cmder $env:path = "$env:path;c:\tools\cmder\vendor\git-for-windows\cmd;c:\tools\cmder\vendor\git-for-windows\usr\bin;c:\tools\cmder\vendor\git-for-windows\mingw64\bin" c: cd $env:userprofile -git clone https://github.com/cmderdev/cmder cmderdev +git clone https://github.com/cmderdev/cmder cmderdev 2>&1 if ("$env:USERNAME" -eq "vagrant" -and -not (test-path "$env:userprofile\cmderdev\vendor\git-for-windows")) { invoke-expression -command "TAKEOWN /F `"$env:userprofile\cmderdev`" /R /D y /s localhost /u vagrant /p vagrant" } cd $env:userprofile/cmderdev -git checkout vagrant+packer -git pull origin vagrant git remote add upstream https://github.com/cmderdev/cmder -git pull upstream master + +Install-PackageProvider -Name NuGet -Force +install-module posh-git -force cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt" Get-Content "$env:temp\vcvars.txt" | Foreach-Object { @@ -23,21 +23,12 @@ Get-Content "$env:temp\vcvars.txt" | Foreach-Object { } } -dir env: +copy-item -erroraction silentlycontinue "C:\Tools\Cmder\Cmder.exe" "$env:userprofile\cmderdev" +remove-item -erroraction silentlycontinue "$env:userprofile\cmderdev\launcher\x64\release\cmder.exe" -force -start-sleep 5 +start-process -erroraction silentlycontinue -nonewwindow -workingdirectory "$env:userprofile\cmderdev\scripts" -filepath "powershell.exe" -argumentlist ".\build.ps1 -verbose -compile" -copy "C:\Tools\Cmder\Cmder.exe" "$env:userprofile\cmderdev" - -del "$env:userprofile\cmderdev\launcher\x64\release\cmder.exe" -force - -start-process -nonewwindow -workingdirectory "$env:userprofile\cmderdev\scripts" -filepath "powershell.exe" -argumentlist ".\build.ps1 -verbose -compile" - -dir "$env:userprofile\cmderdev\launcher\x64\release" - -start-sleep 5 - -copy "$env:userprofile\cmderdev\launcher\x64\release\cmder.exe" "$env:userprofile\cmderdev" -force +copy-item -erroraction silentlycontinue "$env:userprofile\cmderdev\launcher\x64\release\cmder.exe" "$env:userprofile\cmderdev" -force # tabby setx cmder_root "${env:userprofile}\cmderdev" diff --git a/vendor/bin/add-cmdertodesktop.ps1 b/vendor/bin/add-cmdertodesktop.ps1 index 9485636..7309cbf 100644 --- a/vendor/bin/add-cmdertodesktop.ps1 +++ b/vendor/bin/add-cmdertodesktop.ps1 @@ -1,8 +1,14 @@ +if (test-path "c:\windows\set-shortcut.ps1") { + $setShortcut = "c:\windows\set-shortcut.ps1" +} + if (test-path "${env:USERPROFILE}\cmderdev") { $env:cmder_root = "${env:USERPROFILE}\cmderdev" write-host "Creating '${env:USERPROFILE}\Desktop\Cmderdev.lnk'..." - $setShortcut = "$env:cmder_root\vendor\bin\set-shortcut.ps1" + if (test-path "${env:USERPROFILE}\cmderdev\vendor\bin\set-shortcut.ps1") { + $setShortcut = "$env:cmder_root\vendor\bin\set-shortcut.ps1" + } start-process -NoNewWindow -filePath "powershell.exe" -ArgumentList "-file `"${setShortcut}`" -sourceexe `"${env:cmder_root}\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\Desktop\Cmderdev.lnk`" -WorkingDirectory `"${env:cmder_root}`"" }