jim fisher on 29 Mar 2009 15:38:49 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Determining Debian/Ubuntu distro and release?


 cat /etc/apt/sources.list | cut -f5 -d '/'

better ^^

On 3/29/09, jim fisher <jedijf@myfisher.org> wrote:
> Quick and dirty
>
> cat /etc/apt/sources.list | cut -f4 -d '/'
>
>
>
> On 3/29/09, sean finney <seanius@seanius.net> wrote:
>> hiya,
>>
>> On Sun, Mar 29, 2009 at 05:12:14PM -0400, JP Vossen wrote:
>>> So far I have:
>>>
>>> # Release code name (should be 5 lines)
>>> codename=$(perl -ne 'print qq($1\n) if
>>> m!^deb.*?(?:debian|ubuntu)/\s+(\w+)\s+main!;' /etc/apt/sources.list)
>>> [ -n "$codename" ] || {
>>>      echo "Release codename not set, 'export codename=name' before
>>> running..."
>>>      exit 2
>>> }
>>
>> btw, this will get interesting results if you have a system that has
>> sources.list entries referencing both (for example i have deb-src entries
>> for ubuntu on my debian system for various reasons).
>>
>> but i can suggest something a bit easier anyway :)
>>
>> rangda[/home/sean] lsb_release --short --id
>> :)
>> Debian
>> rangda[/home/sean] lsb_release --short --description
>> :)
>> Debian GNU/Linux 5.0 (lenny)
>> rangda[/home/sean] lsb_release --short --release
>> :)
>> 5.0
>> rangda[/home/sean] lsb_release --short --codename
>> :)
>> lenny
>>
>> note that this might not be 100% accurate (i.e. above it says lenny but
>> my system is squeeze/sid), but that's the best "vendor supported way"
>> afaik.
>>
>>
>> 	sean
>>
>
>
> --
> jim fisher
> Jedijf
>
> irc freenode  #ubuntu-us-pa
> www.myfisher.org
>
> "Do, or do not. There is no 'try.'"
>   --  Jedi Master Yoda
>


-- 
jim fisher
Jedijf

irc freenode  #ubuntu-us-pa
www.myfisher.org

"Do, or do not. There is no 'try.'"
  --  Jedi Master Yoda
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug