Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: HOWTO: Easily modify dependencies of a .deb file

  1. #1
    Join Date
    Apr 2006
    Beans
    21

    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

  2. #2

    Re: HOWTO: Easily modify dependencies of a .deb file

    Moved to Packaging and Compiling Programs.
    Ubuntu user #7247 :: Linux user #409907
    inconsolation.wordpress.com

  3. #3
    Join Date
    Jan 2007
    Beans
    27

    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!

  4. #4
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    692
    Distro
    Ubuntu Development Release

    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"

  5. #5
    Join Date
    Aug 2009
    Beans
    3

    Re: HOWTO: Easily modify dependencies of a .deb file

    This script rocks!! What else can I say, many thanks.

  6. #6
    Join Date
    Nov 2009
    Beans
    3,336

    Re: HOWTO: Easily modify dependencies of a .deb file

    Nice well written script .... I like it ..... ty .....

  7. #7
    Join Date
    Jul 2006
    Location
    Edinburgh
    Beans
    180
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOWTO: Easily modify dependencies of a .deb file

    Many thanks!

    My version is called "nanodebcontrol"

  8. #8
    Join Date
    Oct 2010
    Beans
    26

    Re: HOWTO: Easily modify dependencies of a .deb file

    I just wanted to say thanks!

  9. #9
    Join Date
    Oct 2008
    Location
    Italy
    Beans
    Hidden!
    Distro
    Ubuntu

    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"

  10. #10
    Join Date
    May 2010
    Beans
    5

    Re: HOWTO: Easily modify dependencies of a .deb file

    Beautiful! Made my life that much easier!

    Nice one! Thanks a lot!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •