I have a large project where we have the following files:
This product will be installed on appliance hardware that my employer has already selected, using Ubuntu Linux (Lucid) as the target OS, with our goal of distributing the archive as a Debian package to ease installation and upgrades. Additionally, we have a number of ERB templates that we need to "fill-in" with appropriate values on a per-customer basis, so the use of the postinst script will be particularly handy for our purposes.
As a side note, the Debian packages will be stored on a server repository that we manage in-house.
At this stage, I have used dh_make to create the Debian directory and related files (e.g., rules, control, etc.), but the rules file that is generated seems like overkill for my purposes.
Based on this description, all I really need the "rules" file to do is simply copy files from a source directory (or within an archive) to the target directories shown below:
/opt/company_product/3rd_party_binaries/bin /opt/company_product/3rd_party_binaries/etc /opt/company_product/in_hourse_binaries/bin /opt/company_product/in_hourse_binaries/etc /opt/company_product/ruby /opt/company_product/rails_project /opt/company_product/etc /opt/company_product/shared/logs /opt/company_product/shared/tmp /opt/company_product/shared/license
...and so on.
I've read the Debian Policy Manual and several How-To's which indicate that you should not alter the rules file to use mkdir
to create directories and there is generally a dh_ app (e.g., dh_installdirs, et al) that can suit your needs for nearly any installation purposes. The man pages for these dh_ related apps are cursory at best, and I am an "example" kind of guy.
That said, I'm a little lost on what the best approach is to getting my rules file to install my various pre-compiled binaries and Ruby/Rails text files to the desired locations.
Here's my initial rules file. It's pretty much a standard boilerplate rules file that dh_make creates. My thinking is that I should comment out all sections except for the install and then find the appropriate command(s) to make directories, copy files, etc. within that section.
Any advice or suggestions are greatly appreciated.
#!/usr/bin/make -f package = testapp CC = gcc CFLAGS = -g -Wall ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O2 endif #export DH_VERBOSE=1 clean: dh_testdir dh_clean rm -f build install: build dh_clean dh_installdirs echo "Place the Install Script here" cp $(CURDIR)/testapp-2.0.tar.gz $(CURDIR)/debian/$(package)/opt/testapp-2.0 echo "Finished copying folders" build: touch build binary-indep: install # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: install dh_testdir -a dh_testroot -a dh_installdocs -a dh_installchangelogs -a dh_strip -a dh_compress -a dh_fixperms -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean checkroot
Source package control files – debian/control. The debian/control file contains the most vital (and version-independent) information about the source package and about the binary packages it creates. The first paragraph of the control file contains information about the source package in general.
dpkg-buildpackage is a program that automates the process of building a Debian package. It consists of the following steps: 1. It prepares the build environment by setting various environment variables (see ENVIRONMENT), runs the init hook, and calls dpkg-source --before-build (unless -T or --target has been used).
dh_make is a tool to convert a regular source code package into one formatted according to the requirements of the Debian Policy. dh_make must be invoked within a directory containing the source code, which must be named <packagename>-<version>. The <packagename> must be all lowercase, digits and dashes.
All configurations files managed by dpkg are called “conffiles” because that's the name of the field where they are recorded in the dpkg database. You can display the list of conffiles for any package: $ dpkg --status bash [...] Conffiles: /etc/skel/.
Although you've already got your own answer, I'll point out a couple of things.
You seem to be doing this in a very complicated manner. If you simply need to copy files into certain directories, write a debian/mypackagename.install
with the following format:
path/to/file/relative/to/source/root path/to/install/relative/to/system/root
(do not prepend /
before /usr
, or /opt
, or whatever your target directory is. Read man dh_install
for more information)
Then your debian/rules
can be:
#!/usr/bin/make -f %: dh $@
If you have some sort of makefile, etc in your source root, then append this to the above rules
file:
override_dh_auto_build: override_dh_auto_install:
Don't forget put 7
in debian/compat
.
Also, you shouldn't install files into /opt/
or /usr/local/
, etc. Those are meant for files not installed by Debian packages. Debian recommends installing in /usr/share/yourcompany/
. As juzzlin points out below, the Ubuntu Software Center may have different requirements.
More specifically, your mypackage.install
file should look like this:
src/bin/* usr/bin src/etc/* etc/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With