Need more infos on how to create a custom cpaddon

ctrlogic

Member
Nov 4, 2008
17
0
51
Hi I need more infos on how to be able to create a custom cpaddon that's going to take care of website content management...

Just want to know how to install it, so that users can find it in their cpanel... not the script itself...
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Hi I need more infos on how to be able to create a custom cpaddon that's going to take care of website content management...

Just want to know how to install it, so that users can find it in their cpanel... not the script itself...
You can find documentation on how to build a cPAddon wrapper for your script at: http://www.cpanel.net/developer/cpaddons/Creating_Addon_Scripts.htm

While the wrapper must be coded in Perl, the script can be in any programming language (PHP, Ruby, Perl etc.)
 

LP-Trel

Well-Known Member
Oct 13, 2003
183
1
166
Nirvana
Hi David,

Has cPanel looked into implementing more advanced functionality into the cPAddons system? The current system seems significantly more limited than the older addons system that I built the Open Installer on.

The older system allowed for a high degree of flexibility by implementing an installer using a Perl script which allowed us to use almost any function available in Perl. The current system does not allow for that flexibility and that makes more advanced installers harder or impossible to make.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Hi David,

Has cPanel looked into implementing more advanced functionality into the cPAddons system? The current system seems significantly more limited than the older addons system that I built the Open Installer on.

The older system allowed for a high degree of flexibility by implementing an installer using a Perl script which allowed us to use almost any function available in Perl. The current system does not allow for that flexibility and that makes more advanced installers harder or impossible to make.
The cPAddon wrapper is built in Perl so you can use Perl code in there how you desire. You may notice that our install functions are short, because they're just calling some standard code we use for installing apps. However, you can put any Perl code in there that you need.

Are there any specific things you feel are limiting you from doing what you need to do via cPAddons?
 

LP-Trel

Well-Known Member
Oct 13, 2003
183
1
166
Nirvana
Hi David,

Thank you for your reply.

The documentation you linked to doesn't seem to show the method of using this type of functionality.

How would one go about running a command such as:

system("cp","-f","\*.php","install/location/");

using the new cPAddons installers?
 

cPDan

cPanel Staff
Staff member
Mar 9, 2004
724
15
243
The older system allowed for a high degree of flexibility by implementing an installer using a Perl script which allowed us to use almost any function available in Perl. The current system does not allow for that flexibility and that makes more advanced installers harder or impossible to make.
I think you're misunderstanding how it works, let me explain:

Instead of a script there are now functions. You can put any code you want in them.

The "flexibility" and "advanced" part comes from the fact that the logic that 99% of scripts need to get installed is already done and all you have to do is have a hash that describes the script...

For example, instead of copying files around you just have your tarball exist. No need to know where it will be installed or where you are at at the time or that the appropriate "no same owner flag" for the OS's tar is used.

You can of course implement the same logic in the install function yourself but it'd be counter productive to do so.

Now if the standard install does not fit the needs of a script you can have other code before or after it or not even call stdinstall() in the package's install function and implement all of the logic yourself.

Perhaps there are parts of the documentation that could be made clearer?
 

cPDan

cPanel Staff
Staff member
Mar 9, 2004
724
15
243
Hi David,

Thank you for your reply.

The documentation you linked to doesn't seem to show the method of using this type of functionality.

How would one go about running a command such as:

system("cp","-f","\*.php","install/location/");

using the new cPAddons installers?
You just did it :)

change:

Code:
sub install {
    my ($cpa) = @_;
    $cpa->stdinstall(@_);
}
to:

Code:
sub install {
    my ($cpa) = @_;
    $cpa->stdinstall(@_);
    system(@post_install_cmd);
    return 1; # system() returns 0 on success (i.e. $?)
}
For the specific cp command though, you're probably better off doing the tarball correctly, then it's completely moot