Using custom installation roles/tasks (was: Use pear as installation library)
| From: | Gaetano Giunta | Date: | Sat, 07 May 2011 15:31:48 +0000 |
| Subject: | Using custom installation roles/tasks (was: Use pear as installation library) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-54278@lists.php.net to get a copy of this message | ||
I'm trying to use the pear installer to install a package for my application - not Pyrus because of compatibility with php 5.1 and 5.2.
This package comes as a zip already, and a script provided with the app takes care of installing it (unzipped) into the app itself, once it is given the path to the zip file.
As 1st integration step with pear, I'd like to:
1. wrap the original zip in a pear package (to avoid spending too much time in repackaging all the files in the original zip in the new pear package)
2. at install time, have pear copy the zip to some tmp dir, invoke the app installation script to do the rest, and exit - possibly removing the zip from the tmp dir
3. at uninstall time, have the pear uninstall command invoke the app uninstallation script
Point 1: ok so far
Point2: I am trying to use a custom role for this.
- using installable=0 in the role xml file seems to be a good idea, as the zip contained in the pear package needs not to be uninstalled later, and in fact it does not need to be installed at all as-is (existing installation code from the app will unzip it inside the app's package folder)
- when my role's setup() function is called, the pear package is available unzipped somewhere on the filesystem
- otoh it seems that the temporary directory where this file is available is not passed to the setup() call, making my task a bit harder than desired
Alternatives I've found so far:
a. in my role, forego usage of the setup() method, and do what i need by overriding the processInstallation() method, which gets called with the tmp_path as last param (even though this is somewhat dirtier and forces me to set installable=1 and fake an installation directory)
b. forego usage of custom role and use custom task instead
Point 3: it seems that pear uninstallation is only capable of removing files from the filesystem, not to invoke custom scripts/roles/tasks. Is this correct?
Suggestions are welcome!
Thanks
Gaetano