mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-19 14:02:05 +01:00
Merge pull request #420 from myst3k/pluginInstaller-post-move-add-pre-remove
Moved post_install to after install, and created pre_remove script
This commit is contained in:
@@ -104,7 +104,7 @@ class pluginInstaller:
|
||||
os.chdir(currentDir)
|
||||
|
||||
@staticmethod
|
||||
def preScript(pluginName):
|
||||
def preInstallScript(pluginName):
|
||||
pluginHome = '/usr/local/CyberCP/' + pluginName
|
||||
|
||||
if os.path.exists(pluginHome + '/pre_install'):
|
||||
@@ -115,7 +115,7 @@ class pluginInstaller:
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
@staticmethod
|
||||
def postScript(pluginName):
|
||||
def postInstallScript(pluginName):
|
||||
pluginHome = '/usr/local/CyberCP/' + pluginName
|
||||
|
||||
if os.path.exists(pluginHome + '/post_install'):
|
||||
@@ -125,6 +125,17 @@ class pluginInstaller:
|
||||
command = pluginHome + '/post_install'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
@staticmethod
|
||||
def preRemoveScript(pluginName):
|
||||
pluginHome = '/usr/local/CyberCP/' + pluginName
|
||||
|
||||
if os.path.exists(pluginHome + '/pre_remove'):
|
||||
command = 'chmod +x ' + pluginHome + '/pre_remove'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
command = pluginHome + '/pre_remove'
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
@staticmethod
|
||||
def installPlugin(pluginName):
|
||||
@@ -138,22 +149,16 @@ class pluginInstaller:
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Executing pre_install script..')
|
||||
pluginInstaller.preScript(pluginName)
|
||||
pluginInstaller.preInstallScript(pluginName)
|
||||
pluginInstaller.stdOut('pre_install executed.')
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Executing post_install script..')
|
||||
pluginInstaller.postScript(pluginName)
|
||||
pluginInstaller.stdOut('post_install executed.')
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Restoring settings file.')
|
||||
pluginInstaller.upgradingSettingsFile(pluginName)
|
||||
pluginInstaller.stdOut('Settings file restored.')
|
||||
|
||||
###
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Upgrading URLs')
|
||||
pluginInstaller.upgradingURLs(pluginName)
|
||||
@@ -167,16 +172,12 @@ class pluginInstaller:
|
||||
|
||||
##
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Adding interface link..')
|
||||
pluginInstaller.addInterfaceLink(pluginName)
|
||||
pluginInstaller.stdOut('Interface link added.')
|
||||
|
||||
##
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Upgrading static content..')
|
||||
pluginInstaller.staticContent()
|
||||
pluginInstaller.stdOut('Static content upgraded.')
|
||||
@@ -185,6 +186,14 @@ class pluginInstaller:
|
||||
|
||||
pluginInstaller.restartGunicorn()
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Executing post_install script..')
|
||||
pluginInstaller.postInstallScript(pluginName)
|
||||
pluginInstaller.stdOut('post_install executed.')
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Plugin successfully installed.')
|
||||
|
||||
except BaseException as msg:
|
||||
@@ -247,6 +256,12 @@ class pluginInstaller:
|
||||
try:
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Executing pre_remove script..')
|
||||
pluginInstaller.preRemoveScript(pluginName)
|
||||
pluginInstaller.stdOut('pre_remove executed.')
|
||||
|
||||
##
|
||||
|
||||
pluginInstaller.stdOut('Removing files..')
|
||||
pluginInstaller.removeFiles(pluginName)
|
||||
pluginInstaller.stdOut('Files removed..')
|
||||
|
||||
Reference in New Issue
Block a user