Skip to content

Instantly share code, notes, and snippets.

@ytliu74
Created June 10, 2023 03:50
Show Gist options
  • Save ytliu74/9741eb4093e49866dd02378c079b69d7 to your computer and use it in GitHub Desktop.
Save ytliu74/9741eb4093e49866dd02378c079b69d7 to your computer and use it in GitHub Desktop.
A script to update oss-cad-suite
#!/bin/bash
echo "Getting the latest release tag from GitHub API..."
# Get the latest release tag from GitHub API
TAG=$(curl -s https://api.github.com/repos/YosysHQ/oss-cad-suite-build/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
if [[ -z "$TAG" ]]; then
echo "Error: Unable to retrieve the latest release tag from GitHub API"
exit 1
fi
echo "Constructing the filename..."
# Construct the filename
FILENAME="oss-cad-suite-linux-x64-${TAG//[-]/}.tgz"
echo "Downloading the latest release..."
# Download the latest release
wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/${TAG}/${FILENAME}
echo "Extracting the archive..."
# Extract the archive
tar -xvzf ${FILENAME}
echo "Overwriting /opt/oss-cad-suite with the extracted contents..."
# Overwrite /opt/oss-cad-suite with the extracted contents
sudo rm -rf /opt/oss-cad-suite
sudo cp -r oss-cad-suite /opt/oss-cad-suite
echo "Cleaning up..."
# Clean up
rm ${FILENAME}
rm -r oss-cad-suite/
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment