mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Ubuntu] get rid of post-gen rust script (#4575)
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Fix permissions for the Rust folder
|
|
||||||
# https://github.com/actions/virtual-environments/issues/572
|
|
||||||
|
|
||||||
rust_folder="/usr/share/rust"
|
|
||||||
rust_user=$(cut -d: -f1 /etc/passwd | tail -1)
|
|
||||||
|
|
||||||
if [ -d "$rust_folder" ]; then
|
|
||||||
rust_folder_owner=$(ls -ld $rust_folder | awk '{print $3}')
|
|
||||||
if [ "$rust_user" != "$rust_folder_owner" ]; then
|
|
||||||
chown "$rust_user":docker -R $rust_folder
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
function Initialize-RustEnvironment {
|
function Initialize-RustEnvironment {
|
||||||
ln -sf "/usr/share/rust/.rustup" $HOME/.rustup
|
$env:PATH = "/etc/skel/.cargo/bin:/etc/skel/.rustup/bin:$($env:PATH)"
|
||||||
ln -sf "/usr/share/rust/.cargo" $HOME/.cargo
|
$env:RUSTUP_HOME = "/etc/skel/.rustup"
|
||||||
|
$env:CARGO_HOME = "/etc/skel/.cargo"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RustVersion {
|
function Get-RustVersion {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
|
|
||||||
export RUSTUP_HOME=/usr/share/rust/.rustup
|
export RUSTUP_HOME=/etc/skel/.rustup
|
||||||
export CARGO_HOME=/usr/share/rust/.cargo
|
export CARGO_HOME=/etc/skel/.cargo
|
||||||
|
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal
|
||||||
|
|
||||||
@@ -19,19 +19,10 @@ source $CARGO_HOME/env
|
|||||||
rustup component add rustfmt clippy
|
rustup component add rustfmt clippy
|
||||||
cargo install --locked bindgen cbindgen cargo-audit cargo-outdated
|
cargo install --locked bindgen cbindgen cargo-audit cargo-outdated
|
||||||
|
|
||||||
# Permissions
|
|
||||||
chmod -R 777 $(dirname $RUSTUP_HOME)
|
|
||||||
|
|
||||||
# Cleanup Cargo cache
|
# Cleanup Cargo cache
|
||||||
rm -rf ${CARGO_HOME}/registry/*
|
rm -rf ${CARGO_HOME}/registry/*
|
||||||
|
|
||||||
# Update /etc/environemnt
|
# Update /etc/environemnt
|
||||||
prependEtcEnvironmentPath "${CARGO_HOME}/bin"
|
prependEtcEnvironmentPath '$HOME/.cargo/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
|
|
||||||
|
|
||||||
invoke_tests "Tools" "Rust"
|
invoke_tests "Tools" "Rust"
|
||||||
@@ -15,6 +15,13 @@ Describe "Bicep" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Describe "Rust" {
|
Describe "Rust" {
|
||||||
|
BeforeAll {
|
||||||
|
$env:PATH = "/etc/skel/.cargo/bin:/etc/skel/.rustup/bin:$($env:PATH)"
|
||||||
|
$env:RUSTUP_HOME = "/etc/skel/.rustup"
|
||||||
|
$env:CARGO_HOME = "/etc/skel/.cargo"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
It "Rustup is installed" {
|
It "Rustup is installed" {
|
||||||
"rustup --version" | Should -ReturnZeroExitCode
|
"rustup --version" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user