mirror of
https://github.com/xzeldon/dotfiles-wsl2.git
synced 2025-04-04 10:07:11 +03:00
fix: exclude etc directory and wezterm config while copying files from host to wsl
This commit is contained in:
parent
84a04c010b
commit
01cadad79b
18
Install.ps1
18
Install.ps1
@ -108,20 +108,24 @@ if (Test-Path $tempConfigDir) {
|
||||
}
|
||||
New-Item -Path $tempConfigDir -ItemType Directory -Force | Out-Null
|
||||
|
||||
# Process and copy WezTerm config if it exists
|
||||
# Process and copy WezTerm config to Windows home directory only (not WSL)
|
||||
$weztermSourcePath = "$RepoPath\windows\.wezterm.lua"
|
||||
if (Test-Path $weztermSourcePath) {
|
||||
$weztermDestPath = Join-Path $tempConfigDir ".wezterm.lua"
|
||||
$weztermTempPath = Join-Path $env:TEMP ".wezterm.lua.temp"
|
||||
$weztermReplacements = @{
|
||||
'default_domain = "WSL:Arch"' = "default_domain = `"WSL:$DistroName`""
|
||||
}
|
||||
Update-ConfigFile -SourcePath $weztermSourcePath -DestinationPath $weztermDestPath -Replacements $weztermReplacements
|
||||
Copy-Item -Path $weztermDestPath -Destination "$HOME\.wezterm.lua" -Force
|
||||
Update-ConfigFile -SourcePath $weztermSourcePath -DestinationPath $weztermTempPath -Replacements $weztermReplacements
|
||||
Copy-Item -Path $weztermTempPath -Destination "$HOME\.wezterm.lua" -Force
|
||||
Remove-Item -Path $weztermTempPath -Force
|
||||
Write-Host "Updated WezTerm configuration in Windows home directory" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Process and copy all other configuration files from the repository to WSL
|
||||
# First copy to temp directory with replacements
|
||||
Get-ChildItem -Path "$RepoPath\wsl" -Exclude "etc" -Recurse -File | ForEach-Object {
|
||||
# Process and copy all WSL configuration files to temp directory
|
||||
Get-ChildItem -Path "$RepoPath\wsl" -Recurse -File | Where-Object {
|
||||
# Exclude etc directory at any level and Windows-specific files
|
||||
$_.FullName -notmatch "\\etc\\" -and $_.Name -ne ".wezterm.lua"
|
||||
} | ForEach-Object {
|
||||
$relativePath = $_.FullName.Substring("$RepoPath\wsl".Length)
|
||||
$destPath = Join-Path $tempConfigDir $relativePath
|
||||
$destDir = Split-Path -Parent $destPath
|
||||
|
@ -88,6 +88,7 @@ The repository includes an automated setup script that performs all the configur
|
||||
|
||||
#### ⚠️ Important Notes About Automatic Setup
|
||||
|
||||
- **Configuration Overwriting**: The script will overwrite the WezTerm configuration file in your Windows home directory. If you have a custom WezTerm setup, make sure to back it up before running the script.
|
||||
- **Error Handling**: The script does not comprehensively handle all possible errors. If something goes wrong (e.g., incorrect password confirmation, package installation failures), the script will continue execution regardless.
|
||||
- **Network Requirements**: A stable internet connection is required. Using VPNs or proxies is not recommended due to WSL networking limitations.
|
||||
- **User Interaction**: You will need to enter passwords for the root and user accounts during script execution.
|
||||
|
Loading…
x
Reference in New Issue
Block a user