Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install_dependencies.sh #828

Closed
wants to merge 2 commits into from
Closed

Conversation

jakaskerl
Copy link
Contributor

$VERSION_ID returns the Ubuntu distribution version. We want the base Ubuntu version.

Example - Running Linux Mint (Vera):
$VERSION_ID returns 21.1 - which is the Mint version number, but the distro is based on 22.04, so the script errors out.

inxi -Sx | grep -oP '(?<=Ubuntu\s)\d+\.\d+') correctly returns 22.04

$VERSION_ID returns the Ubuntu distribution version. We want the base Ubuntu version.

Example - Running Linux Mint (Vera):
$VERSION_ID returns 21.1 - which is the Mint version number
But the distro is based on 22.04, so the script errors out. 

"inxi -Sx | grep -oP '(?<=Ubuntu\s)\d+\.\d+')" correctly returns 22.04
Copy link
Collaborator

@themarpe themarpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my Ubuntu20.04 inxi is neither installed, nor it returns anything "Ubuntu" like as text.

This will have to be addressed differently

@@ -112,7 +112,8 @@ elif [ -f /etc/os-release ]; then
if [[ "$ID" == "ubuntu" || "$ID" == "debian" || "$ID_LIKE" == "ubuntu" || "$ID_LIKE" == "debian" || "$ID_LIKE" == "ubuntu debian" ]]; then
if [[ ! $(uname -m) =~ ^arm* ]]; then
sudo apt-get update
if [[ "$VERSION_ID" > "22.04" || "$VERSION_ID" == "22.04" ]]; then
UBUNTU_VERSION=$(inxi -Sx | grep -oP '(?<=Ubuntu\s)\d+\.\d+')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inxi is not a default tool

consider something like

Suggested change
UBUNTU_VERSION=$(inxi -Sx | grep -oP '(?<=Ubuntu\s)\d+\.\d+')
UBUNTU_VERSION=$(cat /etc/lsb-release | awk -F '=' '/^DISTRIB_RELEASE=/ {{ print $2 }}')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AnesHadzi,
the /etc/lsb-release doesn't return the correct version on Ubuntu Mint (I get 21.1 codename Vera). The correct info can be found in /etc/upstream-release/lsb-release, but I have checked that stock Ubuntu doesn't have that directory. I'm looking for something that would work across all platofrms, but haven't found anything just yet.
Thanks,
Jaka

Copy link

@AnesHadzi AnesHadzi Jun 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have Mint to try, but IIRC ID from etc/os-release should say something like mint, and the system already relies on that param, you can do:
add if [Mint] cat /etc/upstream-release/lsb-release

@jakaskerl
Copy link
Contributor Author

#970

@jakaskerl jakaskerl closed this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants