1

I'm able to create a deb package. Now, I want to write a Debian rule to copy the file to its target.

For example, a script should be copied to /etc/init.d be executed after installation.

Note: I followed this blog to build debian package https://abz89.wordpress.com/2008/03/24/building-debian-deb-package-from-tarball-source-targz/

prem
  • 499

1 Answers1

3

Use debian/install instead. A debian/install containing:

foo /etc/init.d

Will cause foo to be copied to /etc/init.d relative to the package build directory.

Jacob Vlijm
  • 83,767
muru
  • 197,895
  • 55
  • 485
  • 740
  • Can you please brief about the debian/install. What i did is I have created file debian/mypackage.install it contains rule usr/bin rule etc/init.d/. Here rule is a file, After building the deb package the rule file is not copied to etc/init.d/ & usr/bin/ Any suggestions – prem Sep 17 '15 at 12:59
  • @Jacob the path is supposed to be relative to root, so, without a leading slash. – muru Sep 17 '15 at 13:52
  • @prem where would rule be located after building the source? – muru Sep 17 '15 at 13:53
  • ...ah, I see. I always use with, never tried without. – Jacob Vlijm Sep 17 '15 at 14:38
  • @ muru rule file should be at /etc/init.d/ after building the source – prem Sep 17 '15 at 16:52
  • @prem what? You build the source code and it places the files in your /etc/init.d? What insane program are you building? – muru Sep 17 '15 at 16:53
  • @muru actually it's doesn't meant like that. My scenario is I have a shell script file apart from source files. After building, the script file alone should be place at /etc/init.d . – prem Sep 17 '15 at 17:02
  • @prem So where is that file located? – muru Sep 17 '15 at 17:06
  • @muru for now I'm trying it to kept inside the source file and build it. Please suggest where it should be. I'm very new to making deb – prem Sep 17 '15 at 17:12
  • So if your source code is in some/where, and your debian directory is some/where/debian, rule is in some/where/rule? – muru Sep 17 '15 at 17:13
  • Source code path ubuntu@ip-10-232-76-3:/opt/uat/elasticsearch-1.4.4$ 2. ubuntu@ip-10-232-76-3:/opt/uat/elasticsearch-1.4.4/debian$ 3. rule file path ubuntu@ip-10-232-76-3:/opt/uat/elasticsearch-1.4.4/debian$
  • – prem Sep 17 '15 at 17:21
  • @prem if rule is in debian/, then install should have debian/rule etc/init.d – muru Sep 17 '15 at 17:22
  • @muru where is the install path? – prem Sep 17 '15 at 17:23
  • debian/install or debian/<package>.install – muru Sep 17 '15 at 17:25
  • @muru FYI I dont see any file like that. ubuntu@ip-10-232-76-3:/opt/uat/elasticsearch-1.4.4/debian$ ls -ltr ins* ls: cannot access ins*: No such file directory Even debian/.install is also not there. Please suggest – prem Sep 17 '15 at 17:27
  • You create it, if course. And stop including the prompt. It just makes things hard to read. – muru Sep 17 '15 at 17:29
  • I have created as you per your suggestion. EG mypackagename.install it has debian/rule etc/init.d. After that I build the package and installed like dpkg -i package name . But still the rules file is not going to etc/init.d – prem Sep 17 '15 at 17:33
  • Where is mypackagename.install located, now? And what are you using in debian/rules? – muru Sep 17 '15 at 17:35
  • It's in debian/.install – prem Sep 17 '15 at 17:36
  • @ muru please suggest – prem Sep 17 '15 at 17:54