mirror of
https://github.com/xzeldon/dotfiles-wsl2.git
synced 2025-04-10 06:07:09 +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
|
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"
|
$weztermSourcePath = "$RepoPath\windows\.wezterm.lua"
|
||||||
if (Test-Path $weztermSourcePath) {
|
if (Test-Path $weztermSourcePath) {
|
||||||
$weztermDestPath = Join-Path $tempConfigDir ".wezterm.lua"
|
$weztermTempPath = Join-Path $env:TEMP ".wezterm.lua.temp"
|
||||||
$weztermReplacements = @{
|
$weztermReplacements = @{
|
||||||
'default_domain = "WSL:Arch"' = "default_domain = `"WSL:$DistroName`""
|
'default_domain = "WSL:Arch"' = "default_domain = `"WSL:$DistroName`""
|
||||||
}
|
}
|
||||||
Update-ConfigFile -SourcePath $weztermSourcePath -DestinationPath $weztermDestPath -Replacements $weztermReplacements
|
Update-ConfigFile -SourcePath $weztermSourcePath -DestinationPath $weztermTempPath -Replacements $weztermReplacements
|
||||||
Copy-Item -Path $weztermDestPath -Destination "$HOME\.wezterm.lua" -Force
|
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
|
# Process and copy all WSL configuration files to temp directory
|
||||||
# First copy to temp directory with replacements
|
Get-ChildItem -Path "$RepoPath\wsl" -Recurse -File | Where-Object {
|
||||||
Get-ChildItem -Path "$RepoPath\wsl" -Exclude "etc" -Recurse -File | ForEach-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)
|
$relativePath = $_.FullName.Substring("$RepoPath\wsl".Length)
|
||||||
$destPath = Join-Path $tempConfigDir $relativePath
|
$destPath = Join-Path $tempConfigDir $relativePath
|
||||||
$destDir = Split-Path -Parent $destPath
|
$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
|
#### ⚠️ 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.
|
- **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.
|
- **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.
|
- **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