There is a way to repack installed packages from Ubuntu, so that the same package can be used to install application on other systems as well. Packages are nothing but installation files. Usually we end up downloading these packages for every new installation, in this post we will discuss how to avoid that.
"Fakeroot" simulates the root environment for execution of commands which require root privileges otherwise.
2) Install dpkg. dpkg is a package manager for Debian.
3) Now next step is to repack the package.
This script requires 'package name' of application/library to repack. Usually name of packages and applications/libraries are same, but this is not true in every case. For example consider opencv which is collection of many libraries.
Package name can be confirmed using following command.
3) Now next step is to repack the package.
This script requires 'package name' of application/library to repack. Usually name of packages and applications/libraries are same, but this is not true in every case. For example consider opencv which is collection of many libraries.
Package name can be confirmed using following command.
Having done that use following command to repack.
Entire Backup
The procedure explained above is good only if you need backup of select applications. To repack entire system you need better strategy since typing name of every single package is not that good idea.
So to begin with, we first of all generate a list of installed packages and store that output to a text file.
The output file contains a list of packages. Every row begins with the name of package and the status of that package. We need to remove all the packages which are marked as deinstall from the list. For this you can use simple search and replace.
Next step is to reformat this output file so that is can be as a bash script. Delete all the occurrences of word "install" and remove all new-line characters from the file. Add "sudo fakeroot dpkg-repack " at the beginning of file and save this file as backup.sh . Change file permissions to make it executable and execute backup.sh from terminal. This will generate Debian packages for all the listed package names.
The script should look like this,
No comments:
Post a Comment