2012-06-02 14:13:15 +02:00
|
|
|
# Debian packager (PHP)
|
2012-06-02 14:10:08 +02:00
|
|
|
|
|
|
|
A simple debian packager for PHP applications
|
|
|
|
|
|
|
|
```php
|
|
|
|
<?php
|
|
|
|
|
2012-06-02 14:11:55 +02:00
|
|
|
require_once 'wdm/debian/Autoloader.php';
|
|
|
|
|
2012-06-02 14:10:08 +02:00
|
|
|
$control = new \wdm\debian\control\StandardFile();
|
|
|
|
$control
|
2012-06-04 12:41:13 +02:00
|
|
|
->setPackageName("my-package-name")
|
2012-06-02 14:11:55 +02:00
|
|
|
->setVersion("0.1.1")
|
|
|
|
->setDepends(array("php5", "php5-cli", "php5-xsl"))
|
2012-06-02 14:10:08 +02:00
|
|
|
->setInstalledSize(4096)
|
2012-06-02 14:11:55 +02:00
|
|
|
->setMaintainer("Walter Dal Mut", "walter.dalmut@corley.it")
|
2012-06-02 17:19:33 +02:00
|
|
|
->setProvides("my-package-name")
|
2012-06-02 14:10:08 +02:00
|
|
|
->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();
|
|
|
|
|
|
|
|
//Creates the Debian package
|
|
|
|
$packager->build();
|
2012-06-02 14:13:15 +02:00
|
|
|
```
|
2012-06-04 11:32:48 +02:00
|
|
|
## 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
|
|
|
|
|
|
|
|
```php
|
|
|
|
$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->setPreRemoveScript(__DIR__ . '/my-post-remove-script.sh');
|
|
|
|
```
|
|
|
|
|
2012-06-09 11:30:23 +02:00
|
|
|
See a script example
|
2012-06-04 11:32:48 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
#!/bin/sh
|
|
|
|
#postinst script for upcloo
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Goodbye Cruel World"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
```
|
2012-06-04 12:41:13 +02:00
|
|
|
|