c2fa2ffd7f
* Fix brackets of maintainer email The email address of the maintainer must use angle brackes as per https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Maintainer Also there should be a space between name and email. * Use variable interpolation for maintainer name Since you already use interpolation for maintainer email you can use it for name too. * Fix default value for maintainer The default value for the maintainer still had the square brackets. * Fix tests for StandardFile The tests still used square brackets. |
||
---|---|---|
src/wdm/debian | ||
tests/wdm/debian | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG.md | ||
composer.json | ||
composer.lock | ||
example.php | ||
README.md | ||
VERSION |
Debian packager (PHP)
A simple debian packager for PHP applications
Get composer:
curl -sS http://getcomposer.org/installer | php
Install dependencies and autoloader
php composer.phar install
Use it:
<?php
require_once __DIR__ . '/vendor/autoload.php';
$control = new \wdm\debian\control\StandardFile();
$control
->setPackageName("my-package-name")
->setVersion("0.1.1")
->setDepends(array("php5", "php5-cli", "php5-xsl"))
->setInstalledSize(4096)
->setMaintainer("Walter Dal Mut", "walter.dalmut@corley.it")
->setProvides("my-package-name")
->setDescription("My software description");
;
$packager = new \wdm\debian\Packager();
$packager->setOutputPath("/path/to/out");
$packager->setControl($control);
$packager->mount("/path/to/source-conf", "/etc/my-sw");
$packager->mount("/path/to/exec", "/usr/bin/my-sw");
$packager->mount("/path/to/docs", "/usr/share/docs");
//Creates folders using mount points
$packager->run();
//Get the Debian package command
echo $packager->build();
Create the Package
$(php pack.php)
Pre-Post scripts
Optianally you can add script for different hooks
- pre-install
- Run pre install
- post-install
- Run post install
- pre-remove
- Run pre package remove
- post-remove
- Run post package remove
Adding scripts
$packager->setPreInstallScript(__DIR__ . '/my-pre-install-script.sh');
$packager->setPostInstallScript(__DIR__ . '/my-post-install-script.sh');
$packager->setPreRemoveScript(__DIR__ . '/my-pre-remove-script.sh');
$packager->setPostRemoveScript(__DIR__ . '/my-post-remove-script.sh');
See a script example
#!/bin/sh
#postinst script for upcloo
set -e
echo "Goodbye Cruel World"
exit 0
Use Yaml files instead the library directly
Just take a look to wdalmut/php-deb-describe