A: 

This solved my problem: http://bob.zoller.us/post/156269487/create-a-simple-deb-package

Chip Castle
+1  A: 

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 a / 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. It is better to install in /usr/share/yourcompany/

EDIT: Your mypackage.install file, more specifically should look something like this:

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

...

Umang
Excellent suggestions. Once I do this, which command should I use to build the deb package?
Chip Castle
ok, I ran dpkg-buildpackage and got a .deb file, but when I install it on the target server it doesn't run my debian/mypackagename.install file.Also, if I have scripts that go under init.d, where do I put them?
Chip Castle
Here's my directory structure:build_deploy.rb build_package.rb debian docs extras Rakefile src test.txt.Under src is the following:bin console created_vipre.sql etc filter install.rb opt spf transport. All I want is to have a .deb file that contains everything under src. I then want that exact structure to be copied to /opt/vipre on the target system. I then want everything under src/etc/init.d to be copied to /etc/init.d.I'm not sure why I can't get this. It seems simple, but the docs are confusing me. Please help. Thanks so much.
Chip Castle
Essentially what debhelper does is that if it doesn't know how to install (we don't have a buildsystem like a makefile or python's distutils, if we do, we override it as mentioned above) is it reads `debian/mypackage.install` and dh_install then puts the source files into the target temporary directory (with which the .deb is created). So your `debian/mypackage.install` should like the one I'm going to put into the edited answer. You can run `debbuild` to generate the package. It's generally easier to do that.
Umang
Look at the example I've put in the answer and let me know whether you have any problems with it. If you want to check whether everything look like you want it, you can open your .deb with `gdebi` and then check section on the files that the package will install. Verify that it is like you want. If it isn't, either you or I have got something wrong. If it doesn't like `foobar.install` is being parsed, then you should try adding the override_dh_auto* targets to your rules file that I've put above.
Umang
I've made your requested changes and I get a deb package. I used dupload to send it to my server on ec2, which worked fine on the first attempt. Subsequent uploads reported this error: "Nothing to upload". I'm using reprepro to manage the debian repo. Any suggestions?
Chip Castle
For now I'm manually removing the db directory that reprepro creates on the ec2 server, just so I can test the package installation. On the target machine "sudo apt-get install vipre" reported this (I'm only showing the first few lines of output): The following packages have unmet dependencies: vipre: Depends: libmilter1.0.1 but it is not going to be installed Depends: libruby1.8 (>= 1.8.7.174) but it is not going to be installed Depends: libstdc++5 (>= 1:3.3.4-1) but it is not installable.****libstdc++5 error is a surprise because I removed it from debian/control Dependencies.
Chip Castle
I don't think I can help here. A similar problem I remember having was a `.upload` file in the directory of the `.deb` file. (e.g. `mypackage_1.2.3-1_source.myserver.upload`). `dput` would not upload any version less than or equal to the last upload to that server. See if something similar is happening.
Umang
About your second problem, this could be because you've got an old .deb in your server that hasn't been overridden by a new one. Check the output of commands like `apt-cache depends vipre` and `apt-cache show vipre` clues on this.
Umang