php-deb-packager/README.md

99 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2012-06-02 14:13:15 +02:00
# Debian packager (PHP)
2012-06-02 14:10:08 +02:00
2014-12-03 23:35:36 +01:00
* Develop: [![Build Status](https://travis-ci.org/wdalmut/php-deb-packager.svg?branch=develop)](https://travis-ci.org/wdalmut/php-deb-packager)
* Master : [![Build Status](https://travis-ci.org/wdalmut/php-deb-packager.svg?branch=master)](https://travis-ci.org/wdalmut/php-deb-packager)
2012-06-02 14:10:08 +02:00
A simple debian packager for PHP applications
2014-12-04 08:00:46 +01:00
Get composer:
```
curl -sS http://getcomposer.org/installer | php
```
Install dependencies and autoloader
```
php composer.phar install
```
Use it:
2012-06-02 14:10:08 +02:00
```php
<?php
2014-12-04 07:52:23 +01:00
require_once __DIR__ . '/vendor/autoload.php';
2012-06-02 14:11:55 +02:00
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();
//Get the Debian package command
echo $packager->build();
2012-06-02 14:13:15 +02:00
```
**Create the Package**
```
$(php pack.php)
```
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
2012-06-04 11:32:48 +02:00
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');
2015-07-06 15:23:39 +02:00
$packager->setPostRemoveScript(__DIR__ . '/my-post-remove-script.sh');
2012-06-04 11:32:48 +02:00
```
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
```
2015-04-12 17:37:25 +02:00
## Use Yaml files instead the library directly
Just take a look to [wdalmut/php-deb-describe](https://github.com/wdalmut/php-deb-describe)