mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
more vagrant stuff
This commit is contained in:
parent
d73f9592d8
commit
324aaf74f2
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@ -190,4 +190,6 @@ Vagrant.configure("2") do |config|
|
||||
config.vm.provision "file", source: "./scripts/windows_terminal_settings.json.default", destination: "windows_terminal_settings.json.default"
|
||||
config.vm.provision "file", source: "./scripts/windows_terminal_state.json.default", destination: "windows_terminal_state.json.default"
|
||||
config.vm.provision "shell", path: './scripts/vagrantscript.ps1'
|
||||
config.vm.provision "shell", path: './vendor/bin/add-vscodeprofile.ps1'
|
||||
config.vm.provision "shell", path: './vendor/bin/add-windowsterminalprofiles.ps1'
|
||||
end
|
||||
|
@ -12,6 +12,7 @@ if ("$env:USERNAME" -eq "vagrant" -and -not (test-path "$env:userprofile/cmderde
|
||||
}
|
||||
|
||||
cd cmderdev
|
||||
git checkout vagrant
|
||||
git remote add upstream https://github.com/cmderdev/cmder
|
||||
git pull upstream master
|
||||
|
||||
@ -24,14 +25,16 @@ 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 -filePath "$env:userprofile/bin/set-shortcut.ps1" -ArgumentList "-sourceexe `"C:\\tools\\Cmder\\Cmder.exe`" -DestinationPath `"C:\\Users\\vagrant\\Desktop\\Cmder.lnk`" -WorkingDirectory `"C:\\tools\\Cmder`""
|
||||
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}`""
|
||||
|
||||
write-host "Creating '${env:USERPROFILE}/Desktop/Cmderdev.lnk'..."
|
||||
start-process -filePath "$env:userprofile/bin/set-shortcut.ps1" -ArgumentList "-sourceexe `"${env:USERPROFILE}\\cmderdev\\Cmder.exe`" -DestinationPath `"${env:USERPROFILE}\\Desktop\\Cmderdev.lnk`" -WorkingDirectory `"${env:USERPROFILE}\\cmderdev`""
|
||||
$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 '%userprofile%/cmderdev'
|
||||
setx cmder_root "$env:cmder_root"
|
||||
|
||||
# C:\Users\vagrant\AppData\Roaming\Hyper
|
||||
# // shell: '',
|
||||
|
1
vendor/bin/add-cmderrootenvar.ps1
vendored
Normal file
1
vendor/bin/add-cmderrootenvar.ps1
vendored
Normal file
@ -0,0 +1 @@
|
||||
setx cmder_root "${env:cmder_root}"
|
70
vendor/bin/add-towindowsterminal.ps1
vendored
70
vendor/bin/add-towindowsterminal.ps1
vendored
@ -1,70 +0,0 @@
|
||||
# Windows Terminal
|
||||
$windowsTerminalFolder = (dir "$env:userprofile/AppData/Local/Packages/Microsoft.WindowsTerminal_*").name
|
||||
$windowsTerminalPath = "$env:userprofile/AppData/Local/Packages/$windowsTerminalFolder"
|
||||
$windowsTerminalSettings = $windowsTerminalPath + '/localState/settings.json'
|
||||
$windowsTerminalSettingsNew = $windowsTerminalPath + '/localState/settings-new.json'
|
||||
|
||||
if (test-path "$env:userprofile/Documents/windows_terminal_settings.json.default") {
|
||||
if (test-path "$windowsTerminalPath/LocalState/settings.json") {
|
||||
del "$env:userprofile/Documents/windows_terminal_settings.json.default"
|
||||
} else {
|
||||
move-item -path $env:userprofile/Documents/windows_terminal_settings.json.default -destination $windowsTerminalPath/LocalState/settings.json
|
||||
}
|
||||
}
|
||||
|
||||
if (test-path "$env:userprofile/Documents/windows_terminal_state.json.default") {
|
||||
if (test-path "$windowsTerminalPath/LocalState/state.json") {
|
||||
del "$env:userprofile/Documents/windows_terminal_state.json.default"
|
||||
} else {
|
||||
move-item -path $env:userprofile/Documents/windows_terminal_state.json.default -destination $windowsTerminalPath/LocalState/state.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
|
||||
|
||||
|
74
vendor/bin/add-windowsterminalprofiles.ps1
vendored
Normal file
74
vendor/bin/add-windowsterminalprofiles.ps1
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Windows Terminal
|
||||
$windowsTerminalFolder = (dir "$env:userprofile/AppData/Local/Packages/Microsoft.WindowsTerminal_*").name
|
||||
$windowsTerminalPath = "$env:userprofile/AppData/Local/Packages/$windowsTerminalFolder"
|
||||
$windowsTerminalSettings = $windowsTerminalPath + '/localState/settings.json'
|
||||
$windowsTerminalSettingsNew = $windowsTerminalPath + '/localState/settings-new.json'
|
||||
|
||||
if (test-path "$env:userprofile/Documents/windows_terminal_settings.json.default") {
|
||||
if (test-path "$windowsTerminalPath/LocalState/settings.json") {
|
||||
del "$env:userprofile/Documents/windows_terminal_settings.json.default"
|
||||
} else {
|
||||
move-item -path $env:userprofile/Documents/windows_terminal_settings.json.default -destination $windowsTerminalPath/LocalState/settings.json
|
||||
}
|
||||
}
|
||||
|
||||
if (test-path "$env:userprofile/Documents/windows_terminal_state.json.default") {
|
||||
if (test-path "$windowsTerminalPath/LocalState/state.json") {
|
||||
del "$env:userprofile/Documents/windows_terminal_state.json.default"
|
||||
} else {
|
||||
move-item -path $env:userprofile/Documents/windows_terminal_state.json.default -destination $windowsTerminalPath/LocalState/state.json
|
||||
}
|
||||
}
|
||||
|
||||
if (test-path "$windowsTerminalPath/LocalState/state.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
|
||||
}
|
||||
else {
|
||||
write-host "Cannot add profiles for Windows Terminal. The Windows Terminal settings file does not exist!"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user