[RESOLVE] Find the name of Ubuntu version with Mint

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read this

[RESOLVE] Find the name of Ubuntu version with Mint

Postby percherie on Wed Mar 06, 2013 3:18 pm

Hi,


I use Mint and I want a solution for the name Ubuntu version that matches my version Mint

Nadia For example, I want to get Quantal. It is for use in the command line. Currently the following commands can not function because of the use of $lsb_release -sc

For exemple :
Code: Select all
echo "deb http://download.virtualbox.org/virtualbox/debian `lsb_release -sc` contrib"

OR
Code: Select all
wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list

OR
Code: Select all
echo "deb http://josm.openstreetmap.de/apt `lsb_release -sc` universe #JOSM" | sudo tee -a /etc/apt/sources.list && wget -q http://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add - && sudo apt-get update
Last edited by percherie on Wed Mar 06, 2013 5:55 pm, edited 1 time in total.
percherie
Level 1
Level 1
 
Posts: 4
Joined: Wed Mar 06, 2013 3:10 pm

Linux Mint is funded by ads and donations.
 

Re: Find the name of Ubuntu version with Mint

Postby karlchen on Wed Mar 06, 2013 5:46 pm

Hello, percherie.

On an absolutely up-to-date Mint13 here, there is a file named /etc/os-release. It has been introduced by some Ubuntu update which turned the underlying Ubuntu into 12.04.2. The content of the file /etc/os-release reads
Code: Select all
NAME="Ubuntu"
VERSION="12.04.2 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.2 LTS)"
VERSION_ID="12.04"

Code: Select all
lsb_release -sc
returns the string maya.
So in order to get the string precise which is the codename of the Ubuntu version which Maya has been built upon, I can use the following command:
Code: Select all
grep "PRETTY_NAME" /etc/os-release | awk '{ print $2 }'
It returns the string precise here.
Provided the same file /etc/os-release exists on Nadia as well, the command should return quantal in your case.
I cannot check right now because I am on Mint 13. But I will definitely check next time I boot up Nadia.

HTH,
Karl
Image
Endless legions of bigoted, brutal, bloodthirsty Orcs from the dark land of Mordor are bringing desolation, despair and death to the poor inhabitants of the Middle East. [1]
User avatar
karlchen
Level 10
Level 10
 
Posts: 3128
Joined: Sat Dec 31, 2011 7:21 am

Re: Find the name of Ubuntu version with Mint

Postby percherie on Wed Mar 06, 2013 5:55 pm

Thank you

My english it's light but i am all understand ;-)
percherie
Level 1
Level 1
 
Posts: 4
Joined: Wed Mar 06, 2013 3:10 pm

Re: [RESOLVE] Find the name of Ubuntu version with Mint

Postby karlchen on Thu Mar 07, 2013 6:14 pm

Hello, percherie.

As promised, here is the result of the test done on my Mint 14 system:
Code: Select all
$  lsb_release -sc
nadia
$ grep "PRETTY_NAME" /etc/os-release | awk '{ print $2 }'
quantal
$

So the command works provided the file /etc/os-release is up-to-date.

Cheers,
Karl
Image
Endless legions of bigoted, brutal, bloodthirsty Orcs from the dark land of Mordor are bringing desolation, despair and death to the poor inhabitants of the Middle East. [1]
User avatar
karlchen
Level 10
Level 10
 
Posts: 3128
Joined: Sat Dec 31, 2011 7:21 am

Re: [RESOLVE] Find the name of Ubuntu version with Mint

Postby percherie on Thu Mar 07, 2013 6:57 pm

Thank you karl for your test (and new install of mint)
percherie
Level 1
Level 1
 
Posts: 4
Joined: Wed Mar 06, 2013 3:10 pm

Re: [RESOLVE] Find the name of Ubuntu version with Mint

Postby mirage59 on Wed Oct 02, 2013 1:48 pm

Hello all,

On Olivia, the previous solution doesn't work for me
(Ubuntu version : 13.04, Raring Ringtail)
so to install JOSM with the openstreetmap.de repository and
stay with a recent version of this amazing tool you can use these commands :
Code: Select all
#Add the key
wget -q http://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add -
#Add the repository
echo "deb http://josm.openstreetmap.de/apt `grep "VERSION=" /etc/os-release | tr ',' '\n' | tr '"' ' ' | cut -d' ' -f2 | tail -1 | tr [:upper:] [:lower:]` universe" | sudo tee -a /etc/apt/sources.list


NB : This command isn't elegant but I'm not an awk guru and this have worked fine for me.

Mirage59
mirage59
Level 1
Level 1
 
Posts: 2
Joined: Wed Oct 02, 2013 1:35 pm

Re: [RESOLVE] Find the name of Ubuntu version with Mint

Postby mirage59 on Fri Oct 04, 2013 2:05 pm

Hi all,

I have read a little about awk so this is my prettier solution :

Code: Select all
#Add the key
wget -q http://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add -
#Add the repository
echo "deb http://josm.openstreetmap.de/apt `grep "VERSION=" /etc/os-release | awk '{ print $2 }' | tr [:upper:] [:lower:]` universe" | sudo tee -a /etc/apt/sources.list


Feel free to improve it :wink:

Mirage59
mirage59
Level 1
Level 1
 
Posts: 2
Joined: Wed Oct 02, 2013 1:35 pm

Re: [RESOLVE] Find the name of Ubuntu version with Mint

Postby percherie on Thu Oct 24, 2013 5:13 am

mirage59 wrote:Hi all,

I have read a little about awk so this is my prettier solution :

Code: Select all
#Add the key
wget -q http://josm.openstreetmap.de/josm-apt.key -O- | sudo apt-key add -
#Add the repository
echo "deb http://josm.openstreetmap.de/apt `grep "VERSION=" /etc/os-release | awk '{ print $2 }' | tr [:upper:] [:lower:]` universe" | sudo tee -a /etc/apt/sources.list


Feel free to improve it :wink:

Mirage59


Thank you is better, i like it ;-)
percherie
Level 1
Level 1
 
Posts: 4
Joined: Wed Mar 06, 2013 3:10 pm

Linux Mint is funded by ads and donations.
 

Return to Other topics

Who is online

Users browsing this forum: naviehuynh and 2 guests