Go to file
Jan-Hendrik Frintrop 22b2fcf742 Change default deb package name (#19)
* Change default deb package name

Changed default deb package name to `"{$name}_{$version}_{$arch}.deb"` since this is what normally would be generated.

* Fix tests for default deb name

The tests with default package name still expected the old version of the name.

* Fixed tests

Tests tried to get the Control via `$this->getControl()` which obviously failed.
2017-07-18 12:07:15 +02:00
src/wdm/debian Change default deb package name (#19) 2017-07-18 12:07:15 +02:00
tests/wdm/debian Change default deb package name (#19) 2017-07-18 12:07:15 +02:00
.gitignore Added standard control file test case 2014-12-03 22:38:07 +01:00
.travis.yml Added standard control file test case 2014-12-03 22:38:07 +01:00
CHANGELOG.md Moved to a single changelog file 2015-05-26 10:35:00 +02:00
README.md Minor correction in readme file 2015-07-06 16:23:39 +03:00
VERSION Bumped version 0.0.13 2015-05-27 00:02:33 +02:00
composer.json Added functional test 2015-05-26 10:23:25 +02:00
composer.lock Added functional test 2015-05-26 10:23:25 +02:00
example.php Fixes missing autoloader class 2014-12-04 07:52:23 +01:00

README.md

Debian packager (PHP)

  • Develop: Build Status
  • Master : Build Status

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