[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Advice on packaging a PHP application (ITP for Shaarli)



Hi Mentors and Apache Maintainers,

I am in the process of packaging Shaarli (a delicious clone written in
PHP) for Debian (ITP bug#654814). I would need someone familiar with
packaging a [PHP] web application [for Apache] to guide me in the
right direction. I have looked at the gallery and gallery2 packages to
come up with the following suggestion/scenario:

The zipfile (not a tarball) contains the following 3 folders and 1 php script:

./images/
./inc/
./tpl/
./index.php

Those files constitute the application. I am thinking about placing
those in /usr/share/shaarli

I plan to create an Apache configuration file under
"/etc/shaarli/apache.conf". A symbolic link to this configuration file
would be made by debian/postinst, linking it from
"/etc/apache2/conf.d/". The content of this file would be something
like this:



Alias /links /usr/share/shaarli

<Directory /usr/share/shaarli>
  Options FollowSymLinks
  AllowOverride Limit Options FileInfo
</Directory>

# some people prefer a simple URL like http://links.example.com
#<VirtualHost 1.2.3.4>
#  DocumentRoot /usr/share/shaarli
#  ServerName links.example.com
#</VirtualHost>



Next to that, Shaarli needs to create some folders/files in order to function:
- A data subdirectory
- A cache directory
- A tmp directory

By default, those directories are created in the same folder as where
the application files are (that would mean under /usr/share/shaarli).
Would /var/lib/shaarli be a better place to locate these folders? I
would then patch the index.php file to point to these new locations.

Then a few random questions:
- The current version number is "0.0.32 beta" (including space) as
written on the web page and in the source code, and "0.0.32beta" in
the zipfile. As the version number in Debian can't contain spaces,
would you use "0.0.32beta", or even just drop the "beta" part and use
"0.0.32"?

- By creating the Apache configuration file, I force the user to use
the "/links" url. Is there a better way, for instance on defaulting
with /links, but giving the option to change that using
`dpkg-reconfigure` (which BTW isn't available on my sid install???) Or
is there a way to mark this file as a config file, so that the user
would be able to edit it and it wouldn't later be overwritten during
an upgrade?

- What about using the debian/postinst (and probably a corresponding
debian/postrm)? The Debian New Maintainers' Guide specifically warns
new users against using them [0]. Both gallery and gallery2 use them
to "plug in" the config file (and do other stuff like restarting the
server, and more that I can't honestly say that I fully
understand...). I've attached the postinst and postrm files from the
latest version of gallery for your convenience, would you want to have
a look at it.

- Should I handle more than just Apache2 (other webservers)?

Thanks in advance,
Emilien Klein
P.S.: Please CC me on your response as I'm not subscribed to the list.


[0] http://www.debian.org/doc/manuals/maint-guide/dother.en.html#maintscripts

Attachment: postinst
Description: Binary data

Attachment: postrm
Description: Binary data


Reply to: