5

I have a package which has bug, and i need to modify it, and repack it, So thats how i am doing. Is there any other quick methods?

  1. List/View only (drivers files or applications)

    ar tv DesktopVideo-8.0.1-amd64.deb
    rw-r--r-- 0/0      4 Sep 25 07:35 2011 debian-binary
    rw-r--r-- 0/0 14942208 Sep 25 07:35 2011 control.tar.gz
    rw-r--r-- 0/0    102 Sep 25 07:35 2011 data.tar.gz
    
  2. Extract

    ar x DesktopVideo-8.0.1-amd64.deb
    control.tar.gz  data.tar.gz debian-binary
    
  3. Extract tar.gz

    tar xvfz control.tar.gz
    tar xvfz data.tar.gz
    ;; modify my codes and updates
    
  4. Repack/Rebuild this back

    mkdir -p debian/DEBIAN
    ; step 1
    cp -R ./debian-binary debina/DEBIAN
    cp -R ./control debian/DEBIAN
    cp -R ./control debian/DEBIAN
    cp -R ./control debian/DEBIAN
    ; step 2
    cp -R ./etc debian/DEBIAN
    cp -R ./usr debian/DEBIAN
    
  5. Make .DEB now

    ; this is how the skeleton look like before applying --build
    root@desktop:~/Downloads/test# ls
    control.tar.gz  data.tar.gz  debian  debian-binary  etc  usr
    
    root@desktop:~/Downloads/test# dpkg-deb --build debian
    dpkg-deb: building package `desktopvideo' in `debian.deb'.
    

-- Failed

# dpkg -i DesktopVideo-8.0.1-amd64.deb
dpkg: error processing DesktopVideo-8.0.1-amd64.deb (--install):
 unable to open file '/var/lib/dpkg/tmp.ci//etc': Is a directory
Errors were encountered while processing:
 DesktopVideo-8.0.1-amd64.deb
Jorge Castro
  • 71,754

3 Answers3

4

If you haven't already, install the build tools: sudo apt-get install build-essential

You can use the apt-get source DesktopVideo command to pull the source, diffs, and all other packaging files associated with that deb into the current directory. From there apply your patch, add a new entry in the log file dch -i, then use fakeroot and dpkg to create the package dpkg-buildpackage -rfakeroot -us -uc

Marco Ceppi
  • 48,101
2

It's technically possible to do what you're trying to do, but you need to be far more careful than you seem to be. It's difficult to know what you did wrong because you didn't copy-paste everything you typed. I do spot a typo (cp -R ./debian-binary debina/DEBIAN, you're obviously not reporting exactly what did ), and a mistake (cp -R doesn't preserve ownership and permissions, you would need cp -Rp or cp -a as root).

The best way to modify a package is to get the package source (apt-get source DesktopVideo). Modify the source, then add an entry to the package changelog, changing the version number so that your version is different from the official version number. Here's an example of the steps involved (Debian and Ubuntu work identically in this respect).

If you don't have the source or don't want to recompile, you could install the package, then use dpkg-divert to move the buggy file(s) out of the way and replace it by your own version. dpkg-divert tells the package manager to put a file from a given package in a different location. Here's an example of its use.

If you don't have the source of the package and you need to deploy a fix to several machines, you can install the package, then modify the buggy file, and build a new package with dpkg-repack. It's more of an act of desesperation than a robust way to manage packages; I recommend patching the source and deploying your home-compiled package if at all possible.

1

You should be able to retrieve the package source (you only got the binary there) with apt-get -d source packagename. Then you can tinker around in it and use debuild to build it again.