Skip to content

Instantly share code, notes, and snippets.

@neuthral
Created November 11, 2018 14:16
Show Gist options
  • Save neuthral/364952eb74fef3ff8a11ce033bc0e221 to your computer and use it in GitHub Desktop.
Save neuthral/364952eb74fef3ff8a11ce033bc0e221 to your computer and use it in GitHub Desktop.
Easily modify dependencies of a .deb file #deb #cli #debian #ubuntu
Ubuntu Forums
HOWTO: Easily modify dependencies of a .deb file
Printable View
Show 75 post(s) from this thread on one page
Page 1 of 3123NextLastLast
December 10th, 2007Loevborg
HOWTO: Easily modify dependencies of a .deb file
Save the following script as "videbcontrol",
Code:
chmod +x
it and put it in your path. Then by calling:
Code:
videbcontrol foo.deb
you can edit the "Depends:" line. The resulting .deb file is written to foo.modified.deb in the current directory.
Code:
#!/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
December 20th, 2007K.Mandla
Re: HOWTO: Easily modify dependencies of a .deb file
Moved to Packaging and Compiling Programs.
May 29th, 2008tears.of.angels
Re: HOWTO: Easily modify dependencies of a .deb file
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!
August 14th, 2008motin
Re: HOWTO: Easily modify dependencies of a .deb file
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...
Code:
#!/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"
August 25th, 2009Pablo12
Re: HOWTO: Easily modify dependencies of a .deb file
This script rocks!! What else can I say, many thanks.
June 26th, 201023dornot23d
Re: HOWTO: Easily modify dependencies of a .deb file
Nice well written script .... I like it ..... ty ..... ;)
August 18th, 2010fluffnik
Re: HOWTO: Easily modify dependencies of a .deb file
Many thanks!
My version is called "nanodebcontrol" :)
October 23rd, 2010Losergamer04
Re: HOWTO: Easily modify dependencies of a .deb file
I just wanted to say thanks!
November 7th, 2010Danielaus
Re: HOWTO: Easily modify dependencies of a .deb file
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
Code:
#!/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"
January 26th, 2011roobie
Re: HOWTO: Easily modify dependencies of a .deb file
Beautiful! Made my life that much easier!
Nice one! Thanks a lot! :KS
Show 75 post(s) from this thread on one page
Page 1 of 3123NextLastLast
All times are GMT +1. The time now is 03:15 PM.
vBulletin ©2000 - 2018, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project.
User contributions on this site are licensed under the Creative Commons Attribution Share Alike 4.0 International License. For details and our forum data attribution, retention and privacy policy, see here
#!/bin/bash
# usage: save as 'videbcontrol.sh'; chmod 755 videbcontrol.sh; ./videbcontrol.sh foo.deb
#
# from: http://ubuntuforums.org/showthread.php?t=636724
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment