mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 23:36:11 +01:00
remove csf gui from cyberpanel and keep csf
This commit is contained in:
@@ -858,7 +858,7 @@ sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/urls.py
|
|||||||
if [ ! -e /etc/cxs/cxs.pl ]; then
|
if [ ! -e /etc/cxs/cxs.pl ]; then
|
||||||
sed -i "/configserver/d" /usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html
|
sed -i "/configserver/d" /usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html
|
||||||
fi
|
fi
|
||||||
|
systemctl restart lscpd
|
||||||
### this is temp code for csf
|
### this is temp code for csf
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class CSF(multi.Thread):
|
|||||||
try:
|
try:
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'Downloading CSF..\n', 1)
|
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'Downloading CSF..\n', 1)
|
||||||
|
|
||||||
command = 'wget ' + CSF.csfURL
|
command = 'wget ' + CSF.csfURL
|
||||||
@@ -50,7 +49,7 @@ class CSF(multi.Thread):
|
|||||||
##
|
##
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'Installing CSF..\n', 1)
|
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'Installing CSF..\n', 1)
|
||||||
import os
|
|
||||||
os.chdir('csf')
|
os.chdir('csf')
|
||||||
|
|
||||||
### manually update csf views.py because it does not load CyberPanel properly in default configurations
|
### manually update csf views.py because it does not load CyberPanel properly in default configurations
|
||||||
@@ -420,7 +419,6 @@ class CSF(multi.Thread):
|
|||||||
##### update csf views file
|
##### update csf views file
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'CSF successfully Installed.[200]\n', 1)
|
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'CSF successfully Installed.[200]\n', 1)
|
||||||
import os
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove('csf.tgz')
|
os.remove('csf.tgz')
|
||||||
@@ -442,55 +440,32 @@ class CSF(multi.Thread):
|
|||||||
# for cmd in sed_commands:
|
# for cmd in sed_commands:
|
||||||
# ProcessUtilities.executioner(cmd)
|
# ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
import os
|
command = 'rm -Rfv /usr/local/CyberCP/configservercsf'
|
||||||
import shutil
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
#### this is temp code for csf
|
command = 'rm -fv /home/cyberpanel/plugins/configservercsf'
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
# Function to remove a directory and its contents
|
command = 'rm -Rfv /usr/local/CyberCP/public/static/configservercsf'
|
||||||
def remove_directory(path):
|
ProcessUtilities.normalExecutioner(command)
|
||||||
if os.path.exists(path) and os.path.isdir(path):
|
|
||||||
shutil.rmtree(path, ignore_errors=True)
|
|
||||||
print(f"Removed directory: {path}")
|
|
||||||
|
|
||||||
# Function to remove a file
|
command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/settings.py'
|
||||||
def remove_file(path):
|
ProcessUtilities.normalExecutioner(command)
|
||||||
if os.path.exists(path):
|
|
||||||
os.remove(path)
|
|
||||||
print(f"Removed file: {path}")
|
|
||||||
|
|
||||||
# Function to remove lines containing a specific string from a file
|
command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/urls.py'
|
||||||
def remove_line_from_file(file_path, target_string):
|
ProcessUtilities.normalExecutioner(command)
|
||||||
if os.path.exists(file_path):
|
|
||||||
with open(file_path, 'r') as file:
|
|
||||||
lines = file.readlines()
|
|
||||||
|
|
||||||
with open(file_path, 'w') as file:
|
if os.path.exists('/etc/cxs/cxs.pl'):
|
||||||
for line in lines:
|
|
||||||
if target_string not in line:
|
|
||||||
file.write(line)
|
|
||||||
print(f"Removed lines containing '{target_string}' from {file_path}")
|
|
||||||
|
|
||||||
# Remove directories and files
|
command = 'sed -i "/configserver/d" /usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html'
|
||||||
remove_directory('/usr/local/CyberCP/configservercsf')
|
ProcessUtilities.normalExecutioner(command)
|
||||||
remove_file('/home/cyberpanel/plugins/configservercsf')
|
|
||||||
remove_directory('/usr/local/CyberCP/public/static/configservercsf')
|
|
||||||
|
|
||||||
# Remove 'configservercsf' from specified files
|
|
||||||
remove_line_from_file('/usr/local/CyberCP/CyberCP/settings.py', 'configservercsf')
|
|
||||||
remove_line_from_file('/usr/local/CyberCP/CyberCP/urls.py', 'configservercsf')
|
|
||||||
|
|
||||||
# Check if /etc/cxs/cxs.pl exists and remove 'configserver' from index.html if it doesn't
|
|
||||||
if not os.path.exists('/etc/cxs/cxs.pl'):
|
|
||||||
remove_line_from_file('/usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html',
|
|
||||||
'configserver')
|
|
||||||
|
|
||||||
#### this is temp code for csf
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
try:
|
try:
|
||||||
import os
|
|
||||||
os.remove('csf.tgz')
|
os.remove('csf.tgz')
|
||||||
os.removedirs('csf')
|
os.removedirs('csf')
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user