Wednesday, July 4, 2012

create debian package out of installed packages

dpkg-repack:-

dpkg-repack creates Debian package file out of a package that has already been installed. If any changes have been made to the package while it was unpacked (e.g., files in /etc were modified), the new package will inherit the changes.

This utility can make it easy to copy packages from one computer to another, or to recreate packages which are installed on your system but no longer available elsewhere, or to save the current state of a package before you upgrade it. 


Example situation:-

-> install great game non free from game writer company
-> game writer company goes bankrupt & your CD-ROM is lost.
-> Buy a new computer , want to play great game non free




use dpkg-repack to create a new package to install on new computer


install dpkg-repack:-  apt-get install dpkg-repack

 dpkg-repack coreutils


 mine:~# dpkg --contents coreutils_5.97-5.3_amd64.deb 
drwxr-xr-x root/root         0 2007-02-17 01:44 ./
drwxr-xr-x root/root         0 2007-02-17 01:44 ./bin/
-rwxr-xr-x root/root     69104 2007-01-30 20:38 ./bin/mv
-rwxr-xr-x root/root     15560 2007-01-30 20:38 ./bin/false
-rwxr-xr-x root/root     40128 2007-01-30 20:38 ./bin/touch
-rwxr-xr-x root/root     36072 2007-01-30 20:38 ./bin/chmod
-rwxr-xr-x root/root     21448 2007-01-30 20:38 ./bin/cat


If you don't wish to run the rebuild as root, and you have the fakeroot package installed you can do so as follows:

skx@mine:~$ fakeroot -u dpkg-repack bash
dpkg-deb: building package `bash' in `./bash_3.1dfsg-8_amd64.deb'.


for more options see man dpkg-repack

dpkg-repack [--root=dir] [--arch=architecture] [--generate] packagename [packagename ...]



Examples:-

sudo dpkg-repack --arch=amd64
dpkg-repack --help


HOWTO: Backup all installed programs/packages

soln: fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`

No comments:

Post a Comment