Home > bash > Modify dependencies of a .deb file

Modify dependencies of a .deb file


You have a .deb file that doesn’t install because of some dependency problem. You want to tweak the list of dependencies yourself.

Example: under Ubuntu 10.10 I wanted to install Boxee TV. I downloaded the .deb file but it didn’t install. It said "Dependency is not satisfiable: libdirectfb-1.0-0|libdirectfb-1.2-0", though I had libdirectfb-1.2-9 on the system. So the natural solution is to modify the dependency from libdirectfb-1.2-0 to libdirectfb-1.2-9. This problem and its solution was provided here.


Here I found a nice script that allows you to modify a .deb file. It extracts the .deb file, you modify the dependencies, then it repacks the file. Easy. The script is the following:


# videbcontrol.sh , from http:// ubuntuforums .org/showthread.php?t=636724

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1

TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1


MOD=`stat -c "%y" "$CONTROL"`

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"

rm -r "$TMPDIR"


Categories: bash Tags: ,
  1. January 18, 2011 at 17:21

    Well, they should not depend on packaging versions: ie: libdirectfb-1.2-9 That -9 is the 1.2 packae 9th revision, it’s going to be bothersome and it is a serius debian policy violation. You should report a bug. Workarounds only work for one person. Bugfixes make kittens happy :)

  1. August 6, 2014 at 14:47
  2. December 5, 2014 at 16:13

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: