Debain Package rebuild - linux

I've downloaded .deb package
Then I've extracted all the data from the current .deb file and add a new file with arbitrary content.
My question: how can I create a new .deb package from this modified directory /tmp/tcpdump?

Create a necessity directory structure, then:
dpkg-deb --build package_name
Found answer here: https://ubuntuforums.org/showthread.php?t=910717

Related

Modify rpm using rpmrebuild

I have a rpm created for dev environment and CONTAINS a configuration file that points to dev. Now I have to create the rpm for another environment for which I need to replace just one file in the SOURCES folder and update the reference in .spec and rebuild it. Issue is that I don't have the .spec file that I used to create the rpm for dev.
So upon searching, came across rpmrebuild and I was able to see the .spec file in the editor.
When I give rpmrebuild command, the spec file opens in the editor.
Here's the small snippet from the file
/root/rpmbuild/SOURCES /root/rpmbuild/SOURCES
%files
%attr(0755, root, root) "/opt/**{replace/with/newfile/path**}"
But updating that that gives me - File not found: /root/.tmp/rpmrebuild.2345/work/root/opt/{path/to/newfile}
I don't know if I have to use rpmrebuild command with any --params in order to replace the file in the SOURCES and its reference in the .spec. There are no other changes to be made.
Please guide.
Note: I am a unix novice
I presume you do not have the src.rpm for this package. If you do, then it's very easy, simply install that with rpm -ihv /path/to/src/rpm as you would do with any RPM file. The contents, unless specified otherwise, will be extracted to ~/rpmbuild. The spec will be under ~/rpmbuild/SPECS, the sources under ~/rpmbuild/SOURCES, etc.
If you do not have the src.rpm but only the RPM itself, install the rpmrebuild package from the EPEL repos and then:
$ rpmrebuild -e -p /path/to/package
It will open the spec in your default editor. Edit it and save the spec wherever you want.
Then, assuming you have all the needed source files (declared in the spec using the SourceN directives), you can call:
$ rpmbuild -bb /path/to/spec
To rebuild the RPM from the edited spec.

Creating RPM on Mac

I downloaded one of our application which is bundled as an rpm package. I have to update a specific file inside that rpm package. So I extracted the RPM on my Mac using tar xvf rpm_package.rpm .I updated one file after extraction, is there a simple way I can package this again as an RPM.
Not this way.
You can do that if you have access to src.rpm. Then you can unpack the src.rpm. Alter it (https://rpm-packaging-guide.github.io/#packaging-software is your friend). Run rpmbuild (here is how to get rpmbuild to Mac http://timperrett.com/2014/03/23/enabling-rpmbuild-on-mac-osx/ )

RPM-BUILD- Spec file Understanding

I am new in Linux. I want to create a rpm from tar.gz by rpmbuilder. But I am little bit confused about
make PREFIX=/usr/ DESTDIR=%{?buildroot} install
I want to know what is happening by this. If I don't give the PREFIX and DESTDIR what will be happened.
DESTDIR=%{?buildroot} is required for installing to BUILDROOT folder. BUILDROOT folder must contain the same hierarchy of files that should exist after installing of the package, that is why we should install to it.
PREFIX=/usr/ is used for installing not to /usr/local/ but to /usr/, so your binaries will appear in /usr/bin/ folder, not in /usr/local/bin/. Note that this /usr/ folder will exist in BUILDROOT during the work of rpmbuild (because of point 1).

How to get a file/directory added to existing .deb file

We have a nicely tested executable that is installed with a .deb file. We decided that we need to add a couple licensing files to the existing .deb file so that they are readable after installing the .deb file. Is there an easy way to add a couple of text files to the .deb file?
I saw add to archive but it didn't mention .deb files. Just .tar.
I also saw deb package but I wasn't sure about opening the existing package without more info.

Debian packaging and version control

I am building a Debian package from a source tarball. The initial debian directory is created with dh_make.
It creates a directory debian in the directory my tarball was extracted to. I then customize the content of the debian directory to fit my packaging needs. Then I build the package with dpkg-buildpackage -b.
My question is: What is the best (canonical?) way to put the contents of the customized debian directory in version control?
Do I just copy it out of the source directory, keep it in version control somewhere and every time I built, I extract the tarball and copy the directory back?

Resources