Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Been at the for a few days and figure it's high time I get a bit more experienced advice.

I'm working to package a perl application - all of which's files should be placed in the /var/www/<packagename> directory on the system.

So far I've been able to build the package - but it's not placing my files in this directory and I haven't read any concise ways on how to do so.

Right now my package builds properly - apart from lintian warnings but they are mainly that i'm using the template files from dh_make, which i'll update once i get this to work properly.

Essentially right now I have this as my structure:

ls:

packagedirectory-1.0
 - debian directory with control/copyright/rules/ ...
 - directory belonings to app
 - directory belonging to app
 - files belonging to app
package)1.0-1.tar.gz

I've been building with

dpkg-buildpackage -us -uc

(Not signing for now, will do so once properly built) and doing this from the package directory. And this outputs my .deb, .changes , .orig.tar.gz , and .dsc

Any help would be appreciated. Again - the main issue that i'm having here is that I want to put the app files/directories into /var/www/<packagename>upon installation.

share|improve this question
1  
"all of which's files should be placed in the /var/www/<packagename> directory on the system" Are you sure it wouldn't be better to put it under /usr/share/<packagename> and then provide a HTTPd configuration file using Alias or ScriptAlias? –  Ignacio Vazquez-Abrams Jul 5 '12 at 18:56
    
I can check. I didn't write the app - someone else on my team did and when he showed me the configuration he said to place it in the /var/www/<packagename> folder. Right now stackoverflow.com/questions/3214319/… helped a lot to answer my question and I think I answered this and I'll come back and elaborate if it does. But right now it's lunch time :) –  TJ Biddle Jul 5 '12 at 19:03
    
Are you trying to build a package for internal use only, or are you planning on distributing this to the public? –  Zoredache Jul 5 '12 at 20:00
    
@Zoredache - Internal use only. So far it looks like my previous comment solved everything I needed. overprescribed brought up some good points as well which I actually just ran across a few minutes ago, but I'm not too worried about as this is internal. I have a section in my wiki for this info and have being lintian compliant a part of that - and lintian gives errors about /var/www as well. –  TJ Biddle Jul 5 '12 at 23:38

2 Answers 2

Debian packages should not install files under /var/www. This is not one of the /var directories in the File Hierarchy Standard and is under the control of the local administrator. Packages should not assume that it is the document root for a web server; it is very common for users to change the default document root and packages should not assume that users will keep any particular setting.

Packages that want to make files available via an installed web server should instead put instructions for the local administrator in a README.Debian file and ideally include configuration fragments for common web servers such as Apache.

http://lintian.debian.org/tags/dir-or-file-in-var-www.html

phpldapadmin - a popular php based ldap administration tool - comes with a file to be included in /etc/apache2/conf.d/ with two options:

# Option 1: Define /phpldapadmin alias, this is the default
<IfModule mod_alias.c>
    Alias /phpldapadmin /usr/share/phpldapadmin/htdocs
</IfModule>

# OR Option 2: You can also use phpLDAPadmin as a VirtualHost
<VirtualHost *:*>
 ServerName ldap.example.com
 ServerAdmin root@example.com
 DocumentRoot /usr/share/phpldapadmin/htdocs
 ErrorLog logs/ldap.example.com-error.log
 CustomLog logs/ldap.example.com-access.log common
</VirtualHost>

#Then define the directory options like default index, access control etc.
<Directory /usr/share/phpldapadmin/htdocs/>
 DirectoryIndex ...
 ...
</Directory>

Following this example, you'd install the files you want to show in /var/www/yourpackage in /usr/share/yourpackage/htdocs and edit your included apache conf accordingly. Then save the included apache conf snippet in /usr/share/doc/yourpackage/examples/ or install it straight to /etc with the package. Add instructions in README.Debian (in the same doc directory) to have users link /etc/yourapp.conf or /etc/yourapp/apache.conf to /etc/apache2/conf.d/yourapp.conf and restart Apache.

share|improve this answer
1  
If he is building a package for internal use only, then he is the local administrator. If he wants to build a package to deploy files to /var/www that is certainly something he is permitted to do, and even somewhat common. –  Zoredache Jul 5 '12 at 20:02
1  
I upvoted this comment as it has relevant material but didn't particularly answer my questions so I'm not selecting it as the accepted answer. Thank you for the detailed information though! –  TJ Biddle Jul 5 '12 at 23:39

I ended up using the information found in this: http://stackoverflow.com/questions/3214319/i-need-my-debian-rules-file-to-simply-copy-files-to-its-target SO question. While this is not the proper way to place files in the /var/www file if your package is to be used for external use - this works for me as it is an internally used package.

Please see overprescribed's comment regarding this as it does have very detailed information, it just wasn't accepted as it didn't answer the actual question and just said that I shouldn't do that and a way around it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.