-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fall back to ubuntu 22.04 LTS package when kcov is not available on l…
…atest
- Loading branch information
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# Check if the package name is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <package-name>" | ||
exit 1 | ||
fi | ||
|
||
PACKAGE=$1 | ||
apt-get update | ||
|
||
# Check if the package is available on the current system | ||
if apt-cache show "$PACKAGE" > /dev/null 2>&1; then | ||
echo "Package '$PACKAGE' is available in the current repository. Installing..." | ||
apt-get update | ||
apt-get install -y "$PACKAGE" | ||
exit 0 | ||
else | ||
echo "Package '$PACKAGE' is not available in the current repository." | ||
echo "Adding the Ubuntu 22.04 (Jammy) repository..." | ||
fi | ||
|
||
# Add the Ubuntu 22.04 (Jammy) repository | ||
echo "deb http://archive.ubuntu.com/ubuntu jammy main universe" | tee /etc/apt/sources.list.d/ubuntu-jammy.list | ||
|
||
# Update the package list | ||
apt-get update | ||
|
||
# Try to install the package | ||
if apt-get install -y "$PACKAGE"; then | ||
echo "Package '$PACKAGE' installed successfully from the Ubuntu 22.04 repository." | ||
else | ||
echo "Failed to install '$PACKAGE'. It might have unresolved dependencies." | ||
fi | ||
|
||
# Clean up: Remove the Ubuntu 22.04 repository | ||
echo "Cleaning up the Ubuntu 22.04 repository..." | ||
rm /etc/apt/sources.list.d/ubuntu-jammy.list | ||
apt-get update | ||
|
||
exit 0 | ||
|