Skip to content

Commit

Permalink
updated to have OS detection
Browse files Browse the repository at this point in the history
  • Loading branch information
osamaesmailmsft committed Feb 21, 2025
1 parent 02603b4 commit 137741e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions toolkit/scripts/build_cargo_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,16 @@ DIRECTORY_NAME=${DIRECTORY_NAME[0]%//}
pushd "$DIRECTORY_NAME" &> /dev/null
echo "Fetching dependencies to a temporary cache in $DIRECTORY_NAME."

#TODO: installing rust as auto-patcher does not have it installed by default. Possibly remove if auto-patcher will be changed to have rust included.
sudo dnf install -y rust || sudo apt install -y rustc
echo "Installing build prerequisites for AzureLinux..."
CURRENT_OS=$(grep '^ID=' /etc/os-release | cut -d'=' -f2-)
echo "Current OS: $CURRENT_OS" && \
if [ "$CURRENT_OS" = "mariner" ] || [ "$CURRENT_OS" = "azurelinux" ]; then
sudo dnf install -y rust
elif [ "$$CURRENT_OS" = "ubuntu" ]; then
sudo apt install -y rustc
else
$(call print_error,"Unsupported OS: $$CURRENT_OS") ;
fi

# assume there is only one Cargo.toml
TOML_LOCATION=$(find . -maxdepth 2 -name "Cargo.toml" -exec dirname {} \;)
Expand Down

0 comments on commit 137741e

Please sign in to comment.