Created
June 3, 2019 22:41
-
-
Save ay65535/91351d2f556ef0cd31fedb2266a61578 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set fileencoding=utf-8 ff=unix expandtab ts=4 sw=4 ft=powershell : | |
function SetPacmanMirror { | |
### https://qiita.com/yumetodo/items/94a80ca9d6171e9352a2#%E7%B5%90%E8%AB%96 | |
$PacmanDir = 'C:\tools\ruby25\msys64\etc\pacman.d' | |
$Collection = @('mirrorlist.mingw32', 'mirrorlist.mingw64', 'mirrorlist.msys') | |
foreach ($Item in $Collection) { | |
$Src = Join-Path $PacmanDir $Item | |
if (Test-Path "$Src") { | |
#$Src = Get-ChildItem "${Src}*".ToString() | |
$Dst = "${Src}.orig" | |
Copy-Item "$Src" "$Dst" | |
if ($Item -eq 'mirrorlist.mingw32') { | |
$RepoPath = 'MINGW/i686' | |
} | |
elseif ($Item -eq 'mirrorlist.mingw64') { | |
$RepoPath = 'MINGW/x86_64' | |
} | |
elseif ($Item -eq 'mirrorlist.msys') { | |
$RepoPath = 'MSYS2/$arch' | |
} | |
(Get-Content "$Src") | ForEach-Object { $_ -creplace "## Primary", "## Primary`nServer = https://jaist.dl.sourceforge.net/project/msys2/REPOS/${RepoPath}/`n" } | Set-Content "$Src" | |
} | |
} | |
} | |
SetPacmanMirror |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment