mirror of
https://github.com/ScoopInstaller/Main.git
synced 2025-11-04 15:51:23 +00:00
Simplify rustup installer. (#1689)
This commit is contained in:
parent
a859a4f363
commit
0975388fd5
48
rustup.json
48
rustup.json
@ -13,57 +13,19 @@
|
|||||||
".cargo",
|
".cargo",
|
||||||
".rustup"
|
".rustup"
|
||||||
],
|
],
|
||||||
"post_install": "
|
|
||||||
# Copy the installed cargo directory to the rustup persistent data directory
|
|
||||||
$cargoFolder = \"$env:USERPROFILE\\.cargo\"
|
|
||||||
$cargoFolderDestination = \"$persist_dir\\.cargo\"
|
|
||||||
if(Test-Path $cargoFolder)
|
|
||||||
{
|
|
||||||
if(Test-Path $cargoFolderDestination)
|
|
||||||
{
|
|
||||||
Write-Host -F yellow \"Removing existing .cargo folder from scoop's persistent rustup data directory.\"
|
|
||||||
[System.IO.Directory]::Delete($cargoFolderDestination,$true)
|
|
||||||
}
|
|
||||||
Write-Host -F yellow \"Moving '$cargoFolder' to '$persist_dir'\"
|
|
||||||
Move-Item -Force \"$cargoFolder\" \"$persist_dir\"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copy the installed rustup directory to the rustup persistent data directory
|
|
||||||
$rustupFolder = \"$env:USERPROFILE\\.rustup\"
|
|
||||||
$rustupFolderDestination = \"$persist_dir\\.rustup\"
|
|
||||||
$multirustShortcut = \"$env:USERPROFILE\\.multirust\"
|
|
||||||
if(Test-Path $rustupFolder)
|
|
||||||
{
|
|
||||||
if(Test-Path $rustupFolderDestination)
|
|
||||||
{
|
|
||||||
Write-Host -F yellow \"Removing existing .rustup folder from scoop's persistent rustup data directory.\"
|
|
||||||
[System.IO.Directory]::Delete($rustupFolderDestination,$true)
|
|
||||||
|
|
||||||
}
|
|
||||||
Write-Host -F yellow \"Moving '$rustupFolder' to '$persist_dir'\"
|
|
||||||
Move-Item -Force \"$rustupFolder\" \"$persist_dir\"
|
|
||||||
if(Test-Path $multirustShortcut)
|
|
||||||
{
|
|
||||||
Write-Host -F yellow \"Removing old multirust junction.\"
|
|
||||||
[System.IO.Directory]::Delete($multirustShortcut,$true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
",
|
|
||||||
"env_add_path": ".cargo\\bin",
|
"env_add_path": ".cargo\\bin",
|
||||||
"env_set": {
|
"env_set": {
|
||||||
"CARGO_HOME": "$persist_dir\\.cargo",
|
"CARGO_HOME": "$persist_dir\\.cargo",
|
||||||
"RUSTUP_HOME": "$persist_dir\\.rustup"
|
"RUSTUP_HOME": "$persist_dir\\.rustup"
|
||||||
},
|
},
|
||||||
"notes": "You'll need to restart powershell/cmd to have it reload the environment variables so rustup will work correctly",
|
|
||||||
"installer": {
|
"installer": {
|
||||||
"script": "
|
"script": "
|
||||||
|
# Create environment variables for this process
|
||||||
|
[Environment]::SetEnvironmentVariable('CARGO_HOME', \"$persist_dir\\.cargo\", 'Process')
|
||||||
|
[Environment]::SetEnvironmentVariable('RUSTUP_HOME', \"$persist_dir\\.rustup\", 'Process')
|
||||||
|
|
||||||
|
# Install Rustup
|
||||||
& \"$dir\\rustup-init.exe\" -y --no-modify-path
|
& \"$dir\\rustup-init.exe\" -y --no-modify-path
|
||||||
"
|
"
|
||||||
},
|
|
||||||
"uninstaller": {
|
|
||||||
"script": "
|
|
||||||
[Environment]::SetEnvironmentVariable('RUSTUP_HOME',$null,'User')
|
|
||||||
[Environment]::SetEnvironmentVariable('CARGO_HOME',$null,'User')
|
|
||||||
"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user