Skip to content

Commit

Permalink
ci/mkosi.build: install rust 1.81
Browse files Browse the repository at this point in the history
Meantime don't install rust/cargo from mkosi

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
  • Loading branch information
ming1 committed Dec 26, 2024
1 parent 296a4f5 commit 38f5fae
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
40 changes: 40 additions & 0 deletions ci/mkosi.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,43 @@
#
#

install_rust_1_81_to_path() {
local target_dir="$1"

if [[ -z "$target_dir" ]]; then
echo "Usage: install_rust_1_81_to_path <target-directory>"
return 1
fi

# Create the target directory if it doesn't exist
mkdir -p "$target_dir"

# Set environment variables for custom installation paths
export CARGO_HOME="$target_dir"
export RUSTUP_HOME="$target_dir"

# Remove any system-installed Rust to avoid conflicts
dnf remove -y rust

# Install rustup in non-interactive mode
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Add the custom CARGO_HOME bin directory to PATH for this session
export PATH="$CARGO_HOME/bin:$PATH"

# Install Rust 1.81
rustup install 1.81.0

# Set Rust 1.81 as the default version globally (in the custom path)
rustup default 1.81.0

# Verify the installation
if "$CARGO_HOME/bin/rustc" --version | grep -q "1.81.0"; then
echo "Rust 1.81.0 has been installed successfully to $target_dir!"
else
echo "Rust installation failed."
fi
}

create_libublk()
{
Expand Down Expand Up @@ -38,8 +75,11 @@ set -eo pipefail

mkdir -p $DESTDIR/root/
echo "systemctl restart systemd-networkd" >> $DESTDIR/root/.bash_profile
echo "export PATH=/root/bin:\$PATH" >> $DESTDIR/root/.bash_profile
chmod +x $DESTDIR/root/.bash_profile

install_rust_1_81_to_path $DESTDIR/root/

# Copy tests into the dest
mkdir -p $DESTDIR/usr/share

Expand Down
2 changes: 0 additions & 2 deletions ci/mkosi.default.d/fedora/10-fedora.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Packages=
fio-engine-libaio
util-linux
which
rust
cargo
clang
clang-devel
net-tools
Expand Down

0 comments on commit 38f5fae

Please sign in to comment.