Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid permissions setup for the Rust package #750

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions images/linux/scripts/installers/rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh

export RUSTUP_HOME=/usr/share/rust/.rustup
export CARGO_HOME=/usr/share/rust/.cargo
set -e

export RUSTUP_HOME=/etc/skel/.rustup
export CARGO_HOME=/etc/skel/.cargo

curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal

Expand All @@ -32,15 +34,6 @@ for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do
fi
done

# Update /etc/environemnt
prependEtcEnvironmentPath "${CARGO_HOME}/bin"

# Rust Symlinks are added to a default profile /etc/skel
pushd /etc/skel
ln -sf $RUSTUP_HOME .rustup
ln -sf $CARGO_HOME .cargo
popd

# Document what was added to the image
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))"
Expand Down
12 changes: 6 additions & 6 deletions images/win/Windows2016-Azure.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@
"{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1"
]
},
{
"type": "powershell",
dibir-magomedsaygitov marked this conversation as resolved.
Show resolved Hide resolved
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
Expand Down Expand Up @@ -377,12 +383,6 @@
"{{ template_dir }}/scripts/Installers/Install-PHP.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
Expand Down
12 changes: 6 additions & 6 deletions images/win/Windows2019-Azure.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@
"{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
Expand Down Expand Up @@ -350,12 +356,6 @@
"{{ template_dir }}/scripts/Installers/Install-PHP.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Rust.ps1"
]
},
{
"type": "powershell",
"scripts":[
Expand Down
31 changes: 2 additions & 29 deletions images/win/scripts/Installers/Install-Rust.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
Import-Module -Name ImageHelpers

# Rust Env
$env:RUSTUP_HOME="C:\Rust\.rustup"
$env:CARGO_HOME="C:\Rust\.cargo"
$env:RUSTUP_HOME="C:\users\default\.rustup"
$env:CARGO_HOME="C:\users\default\.cargo"

# Download the latest rustup-init.exe for Windows x64
# See https://rustup.rs/#
Expand All @@ -19,33 +19,6 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://win.rustup.rs/x86_64" -OutFile
# Delete rustup-init.exe when it's no longer needed
Remove-Item -Path .\rustup-init.exe

# Add Rust binaries to the path
Add-MachinePathItem "$env:CARGO_HOME\bin"
$env:Path = Get-MachinePath

# Install common tools
rustup component add rustfmt clippy
cargo install bindgen cbindgen

# Run script at startup for all users
$cmdRustSymScript = @"
@echo off

if exist $env:CARGO_HOME (
if not exist %USERPROFILE%\.cargo (
mklink /J %USERPROFILE%\.cargo $env:CARGO_HOME
)
)

if exist $env:RUSTUP_HOME (
if not exist %USERPROFILE%\.rustup (
mklink /J %USERPROFILE%\.rustup $env:RUSTUP_HOME
)
)
"@

$cmdPath = "C:\Rust\rustsym.bat"
$cmdRustSymScript | Out-File -Encoding ascii -FilePath $cmdPath

# Update Run key to run a script at logon
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RUSTSYM" -Value $cmdPath
4 changes: 2 additions & 2 deletions images/win/scripts/Installers/Validate-Rust.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
if (Get-Command -Name 'rustc')
{
Push-Location -Path $env:UserProfile
New-Item -Name ".rustup" -Value "C:\Rust\.rustup" -ItemType Junction
New-Item -Name ".cargo" -Value "C:\Rust\.cargo" -ItemType Junction
New-Item -Name ".rustup" -Value "C:\users\default\.rustup" -ItemType Junction
New-Item -Name ".cargo" -Value "C:\users\default\.cargo" -ItemType Junction
$RustcVersion = rustc --version
Write-Host "$RustcVersion is on the path"
Pop-Location
Expand Down