LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2014, 09:31 AM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
Extracting/RePackaging Deb Package


Here is the original absolute file paths for a working deb package called
blah-amd64.deb:
Code:
dpkg-deb -c blah-amd64.deb |less
drwxr-xr-x root/root         0 2014-12-02 09:48 ./
drwxr-xr-x root/root         0 2014-12-02 09:48 ./usr/
drwxr-xr-x root/root         0 2014-12-02 09:48 ./usr/share/
drwxr-xr-x root/root         0 2014-12-02 09:48 ./usr/share/applications/
-rw-r--r-- root/root       301 2014-12-02 09:48 ./usr/share/applications/blah.desktop
drwxr-xr-x root/root         0 2014-12-02 09:48 ./usr/share/blah/
-rw-r--r-- root/root     17408 2014-01-21 16:53 ./usr/share/blah/blah.1
I extract it via:
Code:
dpkg-deb -x blah-amd64.deb .
dpkg-deb -e blah-amd64.deb ./DEBIAN
which extracts it to the current directory called
Code:
usr/
I make my modification to my file:
Code:
usr/share/blah/blah.1
and when I repackage blah-amd64.deb via:
Code:
sudo dpkg-deb -b . blah-amd64.deb
and look at the absolute paths:
Code:
dpkg-deb -c blah-amd64.deb |less
drwxr-xr-x root/root         0 2014-12-02 09:48 ./
drwxr-xr-x root/root         0 2014-12-02 09:48 ./applications/
-rw-r--r-- root/root       301 2014-12-02 09:48 ./applications/blah.desktop
drwxr-xr-x root/root         0 2014-12-02 09:48 ./blah/
-rw-r--r-- root/root     17408 2014-01-21 16:53 ./blah/blah.1
it changes the path to "/". I want to repackage it back to its original location so when the package is installed, it will install it in the correct path which is /usr/share/blah. Can someone shed some light on what is going on?

Last edited by metallica1973; 12-03-2014 at 10:06 AM.
 
Old 12-04-2014, 04:11 AM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
What directory are you running

Code:
dpkg-deb -b . blah-amd64.deb
from? The parent of usr, or somewhere inside the tree, like (my guess) <parent>/usr/share/? If the latter, try running it from the parent of usr.

Last edited by goumba; 12-04-2014 at 04:12 AM.
 
Old 12-10-2014, 11:33 AM   #3
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
Thank you for your reply. I was able to resolve it using another method:

2 - Extract the deb package:
Code:
ac -x blah-amd64.deb

ls -ltr

-rw-r--r-- 1 root root        4 Dec  3 15:53 debian-binary
-rw-r--r-- 1 root root 92233080 Dec  3 15:58 data.tar.gz
-rw-r--r-- 1 root root      684 Dec  3 16:36 control.tar.gz
3 - Create a DEBIAN directory and extract the control file there because it is need for the rebuild:
Code:
mkdir DEBIAN
cp control.tar.gz DEBIAN
tar zcvf control.tar.gz
ls -ltr

-rwxr-xr-x 1 root root 210 Dec  2 09:49 prerm
-rwxr-xr-x 1 root root 255 Dec  2 09:49 postrm
-rwxr-xr-x 1 root root 193 Dec  2 09:49 postinst
-rw-r--r-- 1 root root 296 Dec  3 16:34 control
-rw-rw-r-- 1 root root 684 Dec  3 16:36 control.tar.gz
4 - Retar up the control file without the control.tar.gz in it:
Code:
tar cvzf data.tar.gz --exclude=control.tar.gz ./
5 - Extract your the data.tar.gz, make your changes and retar it up:
Code:
tar zxvf data.tar.gz 

ls -ltr 

usr/

vi ./usr/share/blah/blah.1
wq

tar zcvf data.tar.gz --exclude=control.tar.gz ./usr
6 - create the simple debian-binary
Code:
cat > debian-binary <<EOF
2.0\n
EOF
to repackage deb file:
Code:
ar rc blah-amd64.deb debian-binary control.tar.gz data.tar.gz
optional use
Code:
dpkg-deb -b directory blah-amd64.deb
To view contents of the deb file:
Code:
ar tv blah-amd64.deb
or dpkg-deb -c blah-amd64.deb
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How best to install deb package jkirchner Slackware 5 10-21-2012 12:38 PM
Is there a way to see when a package (.deb) was installed? ravedog Linux - Newbie 6 06-10-2010 03:50 PM
Could some one test my deb package? jabka Debian 4 12-06-2007 03:06 PM
Modifying and repackaging Slackware package dizzi Slackware 7 05-20-2007 08:35 PM
How to make deb package chrisstooss Debian 6 09-16-2005 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration