October 2014
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  
135

Refs

Categories

Archives

profile for slm on Stack Exchange, a network of free, community-driven Q&A sites

How to programmatically determine the highest version kernel RPM installed?

Background

Recently on the StackExchange site Unix & Linux the following question came up which seemed easy enough to answer.

This turned out to be trickier than I originally thought. What follows is my ultimate answer along with several failed attempts. I leave them so that others can learn from my mistakes.

Solution

TL;DR

The 3rd attempt is what ultimately worked! I’m leaving the first 2 attempts so that others that may come across this post in the future will hopefully gain some insight into how non-trivial a problem it is to parse RPM version information and determine the lineage of which came first, second, etc.

Attempt #1 (didn’t work)

This command will sort the output and give you them in version order:

1
2
3
4
5
$ rpm -q kernel --queryformat "%{VERSION} %{RELEASE}\n"|sort -n
2.6.18 238.12.1.el5
2.6.18 238.19.1.el5
2.6.18 274.12.1.el5
2.6.18 308.8.2.el5

WHY IT DIDN’T WORK: A naive person would think that you can use some variant of the sort command to perform this task, but there is enough variability and inconsistency in the formatting of the actual version information for a given RPM that it just isn’t up to the task.

Attempt #2 (didn’t work)
1
2
$ rpm -q --last kernel | head -n 1 | cut -d' ' -f1
kernel-2.6.35.14-106.fc14

WHY IT DIDN’T WORK: I had high hopes that this approach would yield the results, but the issue with this one as was pointed out to me afterwards, is that the --last switch is merely returning the results sorted by the date the RPMs were installed.

Attempt #3

This one will definitely do the job. I found a suite of tools called RPM Development Tools. There are 2 tools in this suite that will give you the capability to determine whether one version of a RPM is newer or older than another.

If the RPM isn’t already installed you can do so as follows:


…. Continue reading → How to programmatically determine the highest version kernel RPM installed? »»

[one-liner]: Dealing with UEFI

Background

UEFI looks to be a major pain in the @$$, but like it or hate it everyone in the Linux community will need to learn to navigate it. Here’s a list of useful UEFI resources that I’ve come across as I’ve started to get smarter about how to deal with this beast.

Solution

Wikipedia

Ubuntu Docs

AskUbuntu

Rodsbooks.com

Misc.

NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.

[one-liner]: Setting up the Subversion Client RabbitVCS 0.15.0.5 on Fedora 14

Background

If you do any software development work that requires the use of subversion then you may have heard of rabbitvcs. It’s one of the best subversion clients that integrates well with nautilus, under GNOME. I’d been running into an issue however where it wouldn’t allow me to perform a comparison of my checked out working directory and the subversion repository. I was running into this with version 0.14.2.1-3 on my Fedora 14 laptop.

1
2
3
4
5
6
7
% rabbitvcs diff WebDataInterface.java@105 WebDataInterface.java@112
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rabbitvcs/ui/diff.py", line 322, in <module>
    diff_factory(options.vcs, pathrev1[0], pathrev1[1], pathrev2[0], pathrev2[1], sidebyside=options.sidebyside)
  File "/usr/lib/python2.7/site-packages/rabbitvcs/ui/diff.py", line 304, in diff_factory
    return classes_map[vcs](path1, revision_obj1, path2, revision_obj2, sidebyside)
KeyError: 'unknown'

So I thought I’d try out version 0.15.0.5, which appears to be the latest. However I couldn’t find an up to date RPM for Fedora 14, I only found this one for Fedora 16.

Solution

I downloaded the Fedora 16 SRPM and rebuilt it for Fedora 14. I’m providing the RPMs on my yum repository for others that may need them.

The SRPM is available here.

References

NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.

[one-liner]: Download an RTMP Stream & Convert it to an MP3 File via the Fedora/CentOS Command Line

Background

I recently wanted to download a podcast that was being served via a RTMP stream. RTMP (Real Time Messaging Protocol) was initially a proprietary protocol developed by Macromedia for streaming audio, video and data over the Internet, between a Flash player and a server. Macromedia is now owned by Adobe, which has released the specification of the protocol for public use.

Here’s how I was able to download the RTMP stream to a .flv file and convert it to a .mp3 file. Read on for the details.

Solution

step #1 – download the stream

I used the tool rtmpdump to accomplish this. Like so:

NOTE: the tool rtmpdump was available in my Distro’s repository

1
2
3
4
5
6
7
8
9
10
# I was able to get the rtmp url from looking at the page's source!
 
% rtmpdump -r rtmp://url/to/some/file.mp3 -o /path/to/file.flv
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
28358.553 kB / 3561.61 sec
Download complete

step #2 – convert the flv file to mp3

OK, so now you’ve got a local copy of the stream, file.flv. You can use ffmpeg to interrogate the file further and also to extract just the audio portion.

1
2
3
4
5
6
7
% ffmpeg -i file.flv
....
[flv @ 0x25f6670]max_analyze_duration reached
[flv @ 0x25f6670]Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'file.flv':
  Duration: 00:59:21.61, start: 0.000000, bitrate: 64 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 1 channels, s16, 64 kb/s

From the above output we can see that the file.flv contains a single stream, just audio, and it’s in mp3 format, and it’s a single channel. To extract it to a proper mp3 file you can use ffmpeg again:


…. Continue reading → [one-liner]: Download an RTMP Stream & Convert it to an MP3 File via the Fedora/CentOS Command Line »»

[one-liner]: Using yum-builddep to Speed Up the Building of SRPMs on Fedora & CentOS

Background

I just came across this nifty little tool called yum-builddep, which is part of the yum-utils package. It can be a really big time saver if you need to build source RPMS (SRPMs). What does it do? yum-builddep, installs all the RPM dependencies required to build a given SRPM.

Solution

Installation is a snap, it’s just part of the yum-utils package on Fedora & CentOS.

1
yum install yum-utils

Once installed you can use it like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# on my Fedora 14 system
 
% yum-builddep sox
...
 
Dependencies Resolved
 
===========================================================================================
Package                     Arch          Version                    Repository        Size
===========================================================================================
Installing:
 flac-devel                 x86_64        1.2.1-6.fc12               fedora           605 k
 gsm-devel                  x86_64        1.0.13-2.fc12              fedora            13 k
 ladspa-devel               x86_64        1.13-6.fc12                fedora            18 k
 libao-devel                x86_64        1.0.0-2.fc14               updates           33 k
 libid3tag-devel            x86_64        0.15.1b-10.fc13            fedora           9.3 k
 libsamplerate-devel        x86_64        0.1.7-2.fc12               fedora           8.3 k
 libsndfile-devel           x86_64        1.0.25-1.fc14              updates          140 k
 libtool-ltdl-devel         x86_64        2.2.10-3.fc14              fedora           166 k
 pulseaudio-libs-devel      x86_64        0.9.21-7.fc14              updates          302 k
 wavpack-devel              x86_64        4.60.1-1.fc14              updates           50 k
Installing for dependencies:
 ladspa                     x86_64        1.13-6.fc12                fedora            34 k
 pulseaudio-libs-zeroconf   x86_64        0.9.21-7.fc14              updates           26 k
 
Transaction Summary
===========================================================================================
Install      12 Package(s)
 
Total download size: 1.4 M
Installed size: 8.6 M
Is this ok [y/N]:

Notice it’s determining what libraries and other RPMs are required to BUILD sox from source, not just what is needed to install sox. Here’s another example, probably more consistent with how most people will end up using yum-builddep, where you’ll use it as an aid in rebuilding a SRPM package.


…. Continue reading → [one-liner]: Using yum-builddep to Speed Up the Building of SRPMs on Fedora & CentOS »»

[one-liner]: Installing 3rd Party Apps (Java, Skype, MS Fonts, and Codecs) using the app easyLife on Fedora Linux

Background

Never heard of this app before, easyLife, but it purports to simplifying the installation of the extras that you typically will need on your Fedora system, (i.e. Java, Nvidia, Skype, Adobe Flash, Fonts, etc.). It works like other apps have in the past, Automatix & Ultamatix, on Ubuntu, and Fedora Frog just to name a few.

Solution

easyLife provides an easy installation method for the following 3rd party software on Fedora:

  • Sets “sudo” command up for your regular user;
  • Configures RPMFusion repository for extra and non-free software;
  • Installs Flash Player plugin;
  • Installs all kinds of Codecs (h264,divx,xvid,mp3 etc);
  • Installs nvidia and ati drivers;
  • Installs Skype;
  • Installs Sun Java and Sun Java Plugin for Firefox;
  • Integrates Sun Java with system-switch-java;
  • And many others…

Installation is dead simple.

1
2
3
4
5
6
7
8
# download the latest version
% curl -L 'http://sourceforge.net/projects/easylife-linux/files/latest/download?source=files' 2> /dev/null > easylife_latest.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 59384  100 59384    0     0  41328      0  0:00:01  0:00:01 --:--:-- 80575
 
# install the rpm
% su -c "rpm -Uvh easylife_latest.rpm"

And here’s what easyLife looks like once you fire it up.

easyLife Main Window

easyLife Main Window

References

NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.

Page 1 of 912345...Last »