SOLVED Update script for WHM plugin

jimlongo

Well-Known Member
Mar 20, 2008
237
16
68
I have a bash install script, and uninstall script.

I want to know if there's a recommended way to write an update script.

In addition can anyone share any strategies for auto-update of a plugin?

Thanks for any info you might have.
 

jimlongo

Well-Known Member
Mar 20, 2008
237
16
68
OK. I've got a working update script, it's really the install script using cp -u to update new components, and that works by updating files without overwriting configuration files.

Next question: (in app update).

I'd like to offer both auto-update (by installing a cron command to run my installer) and a manual update button.
The update button calls a php file that tries to run my install script (called from a remote location), and this is proving problematic. When I click the button I get a 403 error.

How do I deal with this?


HTTP error 403
cgi/ToplineVentures/update.php
WHM is configured to disallow execution of unregistered applications when logged in as root or a reseller with the "all" ACL. To enable this functionality you must do one of the following: Register this addon with the /usr/local/cpanel/bin/register_appconfig script (Guide to WHM Plugins - The AppConfig System - Developer Documentation - cPanel Documentation), Enable the "Allow apps that have not registered with AppConfig to be run when logged in as root or a reseller with the "all" ACL in WHM" option in "Tweak Settings", or add permit_unregistered_apps_as_root=1 to the /var/cpanel/cpanel.config file, and run the /usr/local/cpanel/etc/init/startcpsrvd script.



Top recap, the link calls a php file, which contains
Code:
<?php
exec ("cd ~ && curl -s -o installcpanel https://myresources.com/resources/installcpanel-R.sh > /dev/null && bash installcpanel");[code]
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,910
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @jimlongo,

HTTP error 403
cgi/ToplineVentures/update.php
WHM is configured to disallow execution of unregistered applications when logged in as root or a reseller with the "all" ACL. To enable this functionality you must do one of the following: Register this addon with the /usr/local/cpanel/bin/register_appconfig script (Guide to WHM Plugins - The AppConfig System - Developer Documentation - cPanel Documentation), Enable the "Allow apps that have not registered with AppConfig to be run when logged in as root or a reseller with the "all" ACL in WHM" option in "Tweak Settings", or add permit_unregistered_apps_as_root=1 to the /var/cpanel/cpanel.config file, and run the /usr/local/cpanel/etc/init/startcpsrvd script.
You'd need to first follow the instructions found in the output of the error message above. To apply this to only this plugin, you can follow the instructions at:

Guide to WHM Plugins - AppConfig Registration - Developer Documentation - cPanel Documentation

Thank you.
 

jimlongo

Well-Known Member
Mar 20, 2008
237
16
68
Thanks Michael, it sounds like the instructions would apply if I (the admin) manually set those items.

But this is a plugin which should just work from the admin's perspective, not have to manually intervene.
The plugin is registered with AppConfig.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,910
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @jimlongo,

If the application is registered, then the following two options under the Security tab in WHM >> Tweak Settings could be leading to that error message:

This setting allows WHM applications and addons to execute even if an ACL list has not been defined
This setting allows cPanel and Webmail applications and addons to execute even if a feature list has not been defined


Do you have an ACL list and feature list defined for this application in it's configuration file? If not, we document how to configure this for the application at:

Guide to WHM Plugins - AppConfig Configuration File - Developer Documentation - cPanel Documentation

Let me know if this helps.

Thank you.