Creating a New cPAddon Script

You will first need to create a script compatible with the cPAddons system if you wish for the script to be accessible from the cPanel interface. To view examples of such scripts, see http://httpupdate.cpanel.net/cpanelsync/cpaddons/cPanel/.

Assuming we are making a cPAddon for a CMS called "Foo" version 1.0, we would follow these steps:

  1. Create the working directory, as well as a backup.
    • Example: mkdir Foo_1.0.work & mkdir Foo_1.0.orig
  2. Put Foo_1.0.tar.gz into the working directory.
  3. Untar Foo_1.0.tar.gz into Foo_1.0.orig/ and Foo_1.0.work/
    • tar -xvfz Foo_1.0.tar.gz ./Foo_1.0.orig/ & tar -xvfz Foo_1.0.tar.gz ./Foo_1.0.work/
  4. Make a directory Foo/
    • mkdir Foo
  5. Make Foo.pm and place it into the working directory.
  6. Modify Foo_1.0.work/ here as needed.
    • Your goal is to get the files necessary for the install all prepped and together.
    • Remove any install scripts and upgrade scripts, as this is all handled via the cPAddons interface.
    • Prepare any config files. This entails:
    • Set appropriate permissions on all the files (world readable config files and world writable directories will result in a much lower security rating).
  7. Create Foo/1.0.mysql if needed.
    • note Note: The mysql file uses the Config file variables.
    • You should also include a use statement at the top. Assuming the mysql key in the module's $meta_info is 'mysql' => ['foo'],, your mysql file would start like this:
      • | USE [% foo %];|
      • | CREATE TABLE [% table_prefix %]_barbaz (|
  8. Create Foo/1.0.tar.gz from Foo_1.0.work/ by issuing the following commands:
    • cd ./Foo_1.0.work
    • tar -cvfz ../Foo/1.0.tar.gz
    • PICK The reason we use cd above is to ensure that the tarball contains the files as they should be in the installation directory.
  9. Create a file named Foo/lisc (contains your license verbiage).
  10. Install on server or distribute through a cPanel Sync server.

Topic revision: r13 - 24 Nov 2010 - 19:56:16 - MelanieSeibert
CpanelAddons.CreatingScripts moved from Sandbox.CreatingScripts on 18 May 2009 - 17:03 by Main.JustinSchaefer - put it back