Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I ignore dependencies of a single package I am attempting to install using yum in Scientific Linux? The answer would presumably the same for CentOS/RHEL.

To elaborate, I am looking to get the utility lsb_release, which I know would be put into /usr/bin/lsb_release. The command yum whatprovides /usr/bin/lsb_release tells me that it is part of the redhat-lsb packages (for the respective architectures), but those have a bunch of dependencies, including some X11-related.

Since I am only after the lsb_release program, I would like to dodge the "crud" that comes with the dependencies. How can I achieve that?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You can't. Installing the X stuff is probably meaningless, unless you have a tiny amount of storage and every MB counts, or if it includes an entire DE, (which it probably doesn't) since that may include some system configuration you don't want.

If you still don't want to go that route, you should be able to find an appropriate .rpm (you might be able to use yum to get the one from the repo without an install, see here; I haven't tried that and don't know if dependencies will be a hassle; the easiest thing might be to just use rpmfind). You can then unpack the rpm using rpm2cpio and install the lsb_release binary yourself; check it first with ldd lsb_release to make sure the libraries it needs are available. There may also be other little pieces in the rpm you need.

There are already explanations of rpm2cpio online, so I won't repeat all that. If you use the mc filebrowser you can use that instead of rpm2cpio -- it will let you browse the inside of an rpm the same way you might a tarball or zip file.

share|improve this answer
    
Thanks, that got me started into the correct direction. I'll write my own answer to my question, but still accept your anyway, although it didn't go all the way to solve my problem. +1 for now. –  0xC0000022L Feb 15 '13 at 18:35
add comment

Based on the tips from goldilocks' answer, I have come up with this little script which does exactly what I want and no more. It was written on and tested on Scientific Linux 6.3, but might work on other RHEL derivatives. I named the script redhat-lsb.sh (how uncreative).

#!/usr/bin/env bash
WKPKG=redhat-lsb
WKDIR=$HOME/$WKPKG
[[ -d "$WKDIR" ]] && [[ "x$1" != "x-f" ]] && { echo "ERROR: not removing $WKDIR. Use -f to force it."; exit 1; }
(
    [[ -d "$WKDIR" ]] &&  rm -rf "$WKDIR"
    mkdir "$WKDIR" && \
        cd "$WKDIR" && \
        yumdownloader $WKPKG && \
        cd / && \
        rpm2cpio "$WKDIR"/redhat-lsb-*.$(uname -m).rpm | cpio -idmv
) && rm -rf "$WKDIR"

Call as sudo ./redhat-lsb.sh or sudo ./redhat-lsb.sh -f (the latter removes the working directory if it already exists).

What this does is:

  1. uses a folder $HOME/redhat-lsb to work in.
  2. uses yumdownloader to download the package.
  3. uses shell globbing to pick the correct .rpm: redhat-lsb-*.$(uname -m).rpm
  4. changes to / because this is where we want to install it
  5. uses rpm2cpio to unpack it to stdout
  6. cpio catches it and unpacks it into the current directory (this is the step that requires sudo)
  7. finally removes the working folder

And after that, great success ... it works ... without all the dependencies:

$ lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: Scientific
Description:    Scientific Linux release 6.3 (Carbon)
Release:        6.3
Codename:       Carbon

Turns out the package itself only contains a single statically linked executable. The rest are shell scripts and data.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.