mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
bug fix: mautic install issue on alma https://github.com/usmannasir/cyberpanel/issues/1226
This commit is contained in:
@@ -94,6 +94,22 @@ class ApplicationInstaller(multi.Thread):
|
||||
command = f'/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/upgrade.py "SoftUpgrade,{self.data["branchSelect"]}"'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
@staticmethod
|
||||
def setupComposer():
|
||||
|
||||
if os.path.exists('composer.sh'):
|
||||
os.remove('composer.sh')
|
||||
|
||||
if not os.path.exists('/usr/bin/composer'):
|
||||
command = "wget https://cyberpanel.sh/composer.sh"
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = "chmod +x composer.sh"
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = "./composer.sh"
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
def InstallNodeJS(self):
|
||||
|
||||
command = 'npm'
|
||||
@@ -102,7 +118,38 @@ class ApplicationInstaller(multi.Thread):
|
||||
return 1
|
||||
|
||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
|
||||
command = 'dnf module enable nodejs -y dnf install nodejs -y'
|
||||
nodeV = ProcessUtilities.fetch_latest_lts_version_for_node()
|
||||
|
||||
if ACLManager.ISARM():
|
||||
command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-arm64.tar.xz'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'tar -xf node-{nodeV}-linux-arm64.tar.xz '
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'cp node-{nodeV}-linux-arm64/bin/node /usr/bin/node'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = 'curl -qL https://www.npmjs.com/install.sh | sh'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'rm -rf node-{nodeV}-linux-arm64*'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
else:
|
||||
|
||||
command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-x64.tar.xz'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'tar -xf node-{nodeV}-linux-x64.tar.xz'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'cp node-{nodeV}-linux-x64/bin/node /usr/bin/node'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = 'curl -qL https://www.npmjs.com/install.sh | sh'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
|
||||
command = f'rm -rf node-{nodeV}-linux-x64*'
|
||||
ProcessUtilities.executioner(command, 'root', True)
|
||||
else:
|
||||
#command = 'curl -fsSL <https://deb.nodesource.com/setup_20.x> | sudo -E bash -'
|
||||
@@ -133,6 +180,8 @@ class ApplicationInstaller(multi.Thread):
|
||||
statusFile.close()
|
||||
|
||||
self.InstallNodeJS()
|
||||
from plogical.upgrade import Upgrade
|
||||
ApplicationInstaller.setupComposer()
|
||||
|
||||
|
||||
### lets first find php path
|
||||
|
||||
@@ -376,4 +376,23 @@ class ProcessUtilities(multi.Thread):
|
||||
return execPath
|
||||
|
||||
|
||||
@staticmethod
|
||||
def fetch_latest_lts_version_for_node():
|
||||
import requests
|
||||
url = "https://api.github.com/repos/nodejs/node/releases"
|
||||
try:
|
||||
response = requests.get(url)
|
||||
if response.status_code == 200:
|
||||
releases = response.json()
|
||||
for release in releases:
|
||||
if release.get('prerelease') == False and 'LTS' in release.get('name'):
|
||||
lts_version = release.get('tag_name')
|
||||
return lts_version
|
||||
else:
|
||||
print("Failed to fetch releases. Status code:", response.status_code)
|
||||
except Exception as e:
|
||||
print("An error occurred:", e)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user