View Full Version : HOWTO: Easily modify dependencies of a .deb file
Loevborg
December 10th, 2007, 06:08 AM
Save the following script as "videbcontrol", chmod +x it and put it in your path. Then by calling:
videbcontrol foo.deb
you can edit the "Depends:" line. The resulting .deb file is written to foo.modified.deb in the current directory.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$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
fi
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
fi
CONTROL="$TMPDIR"/DEBIAN/control
MOD=`stat -c "%y" "$CONTROL"`
vi "$CONTROL"
if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
echo Not modfied.
else
echo Building new deb...
dpkg -b "$TMPDIR" "$OUTPUT"
fi
rm -r "$TMPDIR"
PS: Thanks to http://ubuntuforums.org/showthread.php?t=110458
K.Mandla
December 20th, 2007, 11:00 AM
Moved to Packaging and Compiling Programs.
tears.of.angels
May 28th, 2008, 11:21 PM
thanks! this is exactly what i've been looking for.
i've been using ruby-ripper (i think i got the deb from getdeb.net) and one of the dependencies is gedit while i'm using medit. changing this allowed me to get rid of gedit!
motin
August 14th, 2008, 04:32 AM
Thanks a million! This made it dead easy to get the debian liblinuxsampler package to install successfully in Ubuntu (where libgig is called libgig6 for some reason).
I modified it slightly to make it easier to use another editor than vi:
Also, I prefer to call it edit-deb-control.sh...
#!/bin/bash
EDITOR=gedit
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$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
fi
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
fi
CONTROL="$TMPDIR"/DEBIAN/control
MOD=`stat -c "%y" "$CONTROL"`
$EDITOR "$CONTROL"
if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
echo Not modfied.
else
echo Building new deb...
dpkg -b "$TMPDIR" "$OUTPUT"
fi
rm -r "$TMPDIR"
Pablo12
August 25th, 2009, 04:10 AM
This script rocks!! What else can I say, many thanks.
23dornot23d
June 26th, 2010, 03:28 PM
Nice well written script .... I like it ..... ty ..... ;)
fluffnik
August 18th, 2010, 11:19 AM
Many thanks!
My version is called "nanodebcontrol" :)
Losergamer04
October 23rd, 2010, 06:09 PM
I just wanted to say thanks!
Danielaus
November 7th, 2010, 08:52 AM
Thanx guys!! Great script!
I just needed it to edit a deb from a ppa with a typo in the dependencies!
YEAH! ;)
I also edited motin version to create the deb file in the current directory and using the name-version from the control file
#!/bin/bash
EDITOR=nano
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
#OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb
OUTPUT="."
#if [[ -e "$OUTPUT" ]]; then
# echo "$OUTPUT exists."
# rm -r "$TMPDIR"
# exit 1
#fi
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
fi
CONTROL="$TMPDIR"/DEBIAN/control
MOD=`stat -c "%y" "$CONTROL"`
$EDITOR "$CONTROL"
if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
echo Not modfied.
else
echo Building new deb...
dpkg -b "$TMPDIR" "$OUTPUT"
fi
rm -r "$TMPDIR"
roobie
January 26th, 2011, 07:18 AM
Beautiful! Made my life that much easier!
Nice one! Thanks a lot! :KS
vambo
May 5th, 2011, 11:16 AM
What a damned useful little script! Many Thanks.
ricky06181993
May 26th, 2011, 04:55 AM
I am completely new to ubuntu and need to know what exactly i need to do to change the dependency in boxee from "libxmlrpc-c3" to "libxmlrpc-c3-0".
Thanks in advance for any help,
Ryan.
derSoldat
May 27th, 2011, 10:05 AM
Registered just to say thanks! This script did exactly what I needed.
emanhossny
June 24th, 2011, 07:51 AM
Hello All,
I'm new to linux & have the problem "dependency is not satisfiable libxmlrpc-c3"
So plz, tell me how can I solve it?
princej88
July 6th, 2011, 10:21 PM
awesome script. Thanks!
ccsalway
August 12th, 2011, 06:31 AM
Im getting:
$sudo: videbcontrol: command not found
Im running Ubuntu server 11.04
archman
August 21st, 2011, 08:49 AM
Im getting:
$sudo: videbcontrol: command not found
Im running Ubuntu server 11.04
Your script is not in PATH, but you don't have to add it. Just cd to the location containing that script and issue "./scriptname ...".
mrgoodknife
October 8th, 2011, 09:16 AM
I've got some questions, because I'm a straight up n00b and downloaded Ubuntu only because it was the best of the "free" options since my copy of windows apparently lost its legitimacy when I did a clean install. I'm trying to turn this computer into a media center, so if someone could basically explain this to me step-by-step, I would greatly appreciate it.
helpdeskdan
November 20th, 2011, 12:41 PM
Thanks! I was leary - 4 year old scripts rarely work, but this did exactly what I needed to get boxee to ignore my libvdpau1 problem. Only one slight modification on line 31 - vim is better than vi. ;-)
As for mrgoodknife, it is frowned upon to post unrelated questions in forums. Start a new thread to ask your question. Better yet, ask Google, who knows all.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.