Re: How to unpack an repack a deb package?

2016-08-26 Thread basti
Hello,
dpkg-deb is your friend. Have a look at
http://unix.stackexchange.com/questions/138188/easily-unpack-deb-edit-postinst-and-repack-deb

But keep in mind, with other dependencies you should rebuild the package.

Best Regards,
basti

On 26.08.2016 16:01, Mark Fletcher wrote:
> 
> 
> On Fri, Aug 26, 2016 at 9:04 PM Hans  > wrote:
> 
> Dear list,
> 
> I need to unpack and repack a debian package. Reason: I want to
> change the
> dependencies in that package.
> 
> 
> I'm reminded of the old IT and general-corporate saying, "Once you open
> a can of worms, the only way to re-can them is to use a larger can"...
> 
> Sorry, couldn't resist it
> 
> Mark



Re: How to unpack an repack a deb package?

2016-08-26 Thread Mark Fletcher
On Fri, Aug 26, 2016 at 9:04 PM Hans  wrote:

> Dear list,
>
> I need to unpack and repack a debian package. Reason: I want to change the
> dependencies in that package.
>
>
I'm reminded of the old IT and general-corporate saying, "Once you open a
can of worms, the only way to re-can them is to use a larger can"...

Sorry, couldn't resist it

Mark


Re: How to unpack an repack a deb package?

2016-08-26 Thread Hans
Hi Christian, 
> Well, the easiest way to do so, if you have Debian's packaging tools
> (notably dpkg-deb and fakeroot) installed:
> 
> ($DIR/ shouldn't exist prior to this and could be the package name)
> dpkg-deb -x package.deb $DIR/
> dpkg-deb -e package.deb $DIR/DEBIAN
> $EDITOR $DIR/DEBIAN/control
> fakeroot dpkg-deb -b $DIR package_repacked.deb
> rm -r $DIR
> 

Yes, great, this worked! I just needed to change the deps od an external 
package (fakturama*.deb) from openjdk-7-jre-headless to openjdk-8-jre-headless 
as the old 7-package would break my system. Doing as you suggested works well 
and I will send the developer a mail. 

What also should work is dpkg --unpack bla.deb /whatever/bla. Howver, I did 
not know, that the DEBIAN directory must be unpacked manually, too.

Most important: It si working as I wanted, and I have learned something more. 
Isn't that the most important? Learning?

Haved a nice weekend and thank you very much!


> Regards,
> Christian
Best 

Hans




Re: How to unpack an repack a deb package?

2016-08-26 Thread Christian Seiler
On 08/26/2016 02:03 PM, Hans wrote:
> I need to unpack and repack a debian package. Reason: I want to change the 
> dependencies in that package. 
> 
> How can I do that? I imagine, to unpack the *.deb, then edit my control file, 
> after that pack it again. 

Well, the easiest way to do so, if you have Debian's packaging tools
(notably dpkg-deb and fakeroot) installed:

($DIR/ shouldn't exist prior to this and could be the package name)
dpkg-deb -x package.deb $DIR/
dpkg-deb -e package.deb $DIR/DEBIAN
$EDITOR $DIR/DEBIAN/control
fakeroot dpkg-deb -b $DIR package_repacked.deb
rm -r $DIR

Example:

apt-get download sed
dpkg-deb -x sed_4.2.2-7.1_amd64.deb sed
dpkg-deb -e sed_4.2.2-7.1_amd64.deb sed/DEBIAN
$EDITOR sed/DEBIAN/control
   (I added Recommends: gawk to the control file and incremented
   the version by adding +local0 at the end)
fakeroot dpkg-deb -b sed sed_4.2.2-7.1+local0_amd64.deb
rm -r sed

If you don't have dpkg-deb installed, you can manually use ar/tar:

ar x sed_4.2.2-7.1_amd64.deb
mkdir sed sed/DEBIAN
tar -C sed -xJf data.tar.xz
tar -C sed/DEBIAN -xzf control.tar.gz
$EDITOR sed/DEBIAN/control
tar -C sed --exclude=DEBIAN --owner=root --group=root -cJf data.tar.xz .
tar -C sed/DEBIAN --owner=root --group=root -czf control.tar.gz .
ar cr sed_4.2.2-7.1+local0_amd64.deb debian-binary control.tar.gz data.tar.xz
(debian-binary should be a file created by the unpacking
with ar x, should contain a single line "2.0")

(Please change the compression algorithms for tar where appropriate,
depending on whether gzip, xz and/or bzip2 are used. My example shows
both gzip and xz for different files.)

There are corner cases when either method won't work properly out of
the box unless you are root or at the very least run the entire shell
you're in under fakeroot. (Notably when files have setuid permissions.)

> Is it that easy? I googled, but ar -x paket.deb /tmp/paket did not work.

ar x, not ar -x (ar is funny that way)

Big Warning: if you do not ALSO change the version of the package
slightly (e.g. by adding +local0 at the end), then this can have all
sorts of unpredictable results if you have package sources with _both_
Debian's version of the package and your modified version. The same
version of a package should _not_ be used twice in Debian for different
packages.

Regards,
Christian



How to unpack an repack a deb package?

2016-08-26 Thread Hans
Dear list,

I need to unpack and repack a debian package. Reason: I want to change the 
dependencies in that package. 

How can I do that? I imagine, to unpack the *.deb, then edit my control file, 
after that pack it again. 

Is it that easy? I googled, but ar -x paket.deb /tmp/paket did not work. The 
dpkg manual did not help me or I misunderstood it.

Thanks for any hints.

Best 

Hans