我需要我的Debian规则文件来简单地将文件复制到它的目标 [英] I need my Debian rules file to simply copy files to it's target

查看:565
本文介绍了我需要我的Debian规则文件来简单地将文件复制到它的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型项目,其中有以下文件:

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

  • 一些第三方的预编译二进制文件
  • 我们自己的内部二进制文件
  • Ruby脚本集合
  • 一个相当大的Ruby on Rails项目
  • A few 3rd party pre-compiled binaries
  • Our own in-house binaries
  • collection of Ruby scripts
  • A sizable Ruby on Rails project

该产品将安装在我的雇主已经选择的设备硬件上,使用Ubuntu Linux(Lucid)作为目标操作系统,我们的目标是将归档文件作为Debian软件包分发以简化安装和升级.此外,我们还有许多ERB模板,需要根据每个客户填充"适当的值,因此对于我们的目的,使用 postinst 脚本将特别方便.

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.

请注意,Debian软件包将存储在我们内部管理的服务器存储库中.

As a side note, the Debian packages will be stored on a server repository that we manage in-house.

在此阶段,我已经使用 dh_make 创建Debian目录和相关文件(例如,规则,控件等),但是出于我的目的,生成的规则文件似乎有些过分了.

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.

基于此描述,我真正需要的规则"文件只是将文件从源目录(或归档文件中)复制到如下所示的目标目录中:

/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

...等等.

我已经阅读了《 Debian策略手册》和一些操作方法,这些方法表明您不应将规则文件更改为使用mkdir创建目录,并且通常有一个 dh_ 应用(例如dh_installdirs等),几乎可以满足您的安装需求.这些与 dh _ 相关的应用程序的手册页充其量是粗略的,我是个榜样"家伙.

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.

这就是说,我对使 rules 文件将各种预编译的二进制文件和Ruby/Rails文本文件安装到所需位置的最佳方法有些困惑.

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.

这是我的初始规则文件.这几乎是dh_make创建的标准样板规则文件.我的想法是,我应该注释掉除 install 以外的所有部分,然后在该部分中找到用于创建目录,复制文件等的适当命令.

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.

您似乎以非常复杂的方式进行此操作.如果只需要将文件复制到某些目录中,请使用以下格式编写debian/mypackagename.install:

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

(不要在/usr/opt或任何目标目录之前添加/.有关更多信息,请阅读man dh_install)

(do not prepend / before /usr, or /opt, or whatever your target directory is. Read man dh_install for more information)

那么您的debian/rules可以是:

#!/usr/bin/make -f

%:
    dh $@

如果您的源根目录中包含某种makefile等,请将其附加到上述rules文件中:

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:

别忘了将7放在debian/compat中.

此外,您不应该将文件安装到/opt//usr/local/等中.这些文件用于由Debian软件包安装的 not 文件. Debian 建议在/usr/share/yourcompany/中安装.作为 juzzlin 下面指出,Ubuntu软件中心可能有不同的要求.

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.

更具体地说,您的mypackage.install文件应如下所示:

More specifically, your mypackage.install file should look like this:

src/bin/* usr/bin
src/etc/* etc/

这篇关于我需要我的Debian规则文件来简单地将文件复制到它的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆