Вопрос

I have a large project where we have the following files:

  • A few 3rd party pre-compiled binaries
  • Our own in-house binaries
  • collection of Ruby scripts
  • A sizable Ruby on Rails project

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
Это было полезно?

Решение

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/

Другие советы

You can install cdbs and change the rules file like this

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk

binary-install/package_name::
                   mkdir debian/$(cdbs_curpkg)/destination_path 
                   cp path_of_your_files  debian/$(cdbs_curpkg)/destination_path
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top