Fixes in scripts
This commit is contained in:
parent
3a665b3d81
commit
cf07859027
7 changed files with 67 additions and 4 deletions
29
scripts/system/install_php.py
Normal file
29
scripts/system/install_php.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python3 -u
|
||||
|
||||
# A script for install pzoo user
|
||||
|
||||
from subprocess import call
|
||||
from time import sleep
|
||||
import distro
|
||||
|
||||
linux_distro=distro.id()
|
||||
|
||||
print('{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Installing php..."}')
|
||||
|
||||
sleep(1)
|
||||
|
||||
if linux_distro=='arch':
|
||||
|
||||
if call("sudo pacman -S --noconfirm php php-gd php-pgsql php-snmp php-sodium php-sqlite", shell=True) > 0:
|
||||
print('Error, cannot install php...')
|
||||
exit(1)
|
||||
|
||||
elif linux_distro=='debian' or linux_distro=='ubuntu':
|
||||
|
||||
if call('sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y php-fpm php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-redis unzip', shell=True) > 0:
|
||||
print('Error, cannot install php...')
|
||||
exit(1)
|
||||
elif linux_distro=='rocky' or linux_distro=='fedora':
|
||||
if call("sudo dnf install -y php php-gd php-mysqlnd php-fpm php-zip", shell=True) > 0:
|
||||
print('Error, cannot install php...')
|
||||
exit(1)
|
||||
18
scripts/system/install_psutil.py
Normal file
18
scripts/system/install_psutil.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3 -u
|
||||
|
||||
# A script for install pzoo user
|
||||
|
||||
import subprocess
|
||||
import argparse
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
import pwd
|
||||
from subprocess import call
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
import distro
|
||||
|
||||
if call("sudo useradd -m -s /bin/bash %s" % args.user, shell=True) > 0:
|
||||
print('Error, cannot install psutil...')
|
||||
exit(1)
|
||||
|
|
@ -13,15 +13,15 @@ DISTRO=`( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head
|
|||
if [[ $DISTRO =~ ^Debian ]] || [[ $DISTRO =~ ^Ubuntu ]]; then
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install python3 python3-pip
|
||||
sudo apt-get -y install python3 python3-pip sudo
|
||||
|
||||
elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
|
||||
|
||||
sudo pacman -Syu --noconfirm python python-pip
|
||||
sudo pacman -Syu --noconfirm python python-pip sudo
|
||||
|
||||
elif [[ $DISTRO =~ ^NAME=\"Rocky ]]; then
|
||||
|
||||
sudo dnf install -y python python-pip
|
||||
sudo dnf install -y python python-pip sudo
|
||||
#Install EPEL
|
||||
dnf config-manager --set-enabled crb
|
||||
sudo dnf install -y \
|
||||
|
|
@ -33,7 +33,7 @@ elif [[ $DISTRO =~ ^Fedora ]]; then
|
|||
|
||||
sudo dnf upgrade -y
|
||||
|
||||
sudo dnf install -y python3 python3-pip
|
||||
sudo dnf install -y python3 python3-pip sudo
|
||||
|
||||
else
|
||||
|
||||
|
|
|
|||
6
scripts/system/install_unixutils.sh
Normal file
6
scripts/system/install_unixutils.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Install unix tools repo.
|
||||
|
||||
sudo pip3 install git+https://bitbucket.org/paramecio/pastafariutils
|
||||
|
||||
|
|
@ -13,6 +13,8 @@ class ServerTask(Task):
|
|||
self.files.append(['modules/pastafari2/scripts/system/install_python.sh', 0o755])
|
||||
self.files.append(['modules/pastafari2/scripts/system/install_psutil.sh', 0o755])
|
||||
self.files.append(['modules/pastafari2/scripts/system/install_git.py', 0o755])
|
||||
self.files.append(['modules/pastafari2/scripts/system/install_php.py', 0o755])
|
||||
self.files.append(['modules/pastafari2/scripts/system/install_unixutils.sh', 0o755])
|
||||
self.files.append(['modules/pastafari2/scripts/system/sudoers.d/spanel', 0o640])
|
||||
|
||||
self.files.append([self.data['pub_key'], 0o600])
|
||||
|
|
@ -22,6 +24,8 @@ class ServerTask(Task):
|
|||
#self.commands_to_execute.append(['modules/pastafari2/scripts/system/alive.sh', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_python.sh', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_git.py', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_php.py', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_unixutils.sh', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', ''])
|
||||
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_pzoo_stats.py', '--user='+self.data['ssh_user']+' --pub_key='+self.data['pub_key']+' --url_stats='+self.data['url_stats']+' --group="'+self.data['group_name']+'" --path='+remote_path])
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<%inherit file="dashboard.phtml"/>
|
||||
<%block name="content">
|
||||
<%block name="go_back_top">
|
||||
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
|
||||
</%block>
|
||||
<h2>${name_task}</h2>
|
||||
<p>${description_task}</p>
|
||||
<hr />
|
||||
|
|
@ -17,8 +19,10 @@
|
|||
<div id="finished" style="display:none;">
|
||||
<p><strong>All tasks were finished.</strong></p>
|
||||
</div>
|
||||
<%block name="go_back_bottom">
|
||||
<p><a href="${url_for('.pastafari2_dashboard')}">${lang('pastafari2', 'servers', 'Servers')}</a> >> ${lang('pastafari2', 'task_progress', 'Task progress')}</p>
|
||||
</%block>
|
||||
</%block>
|
||||
<%block name="jscript_block">
|
||||
<script>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@
|
|||
</%block>
|
||||
<%block name="content">
|
||||
<h3>${hostname}</h3>
|
||||
<%block name="return_block"></%block>
|
||||
<h2>${lang('pastafari2', 'task progress', 'Task progress')} - ${name_task}</h2>
|
||||
<p>${description_task}</p>
|
||||
<hr />
|
||||
<i class="fa fa-cog fa-spin fa-5x fa-fw margin-bottom" id="gear"></i>
|
||||
<div id="progressbar"><div class="progress-label">${lang('pastafari2', 'processing_task', 'Processing task...')}</div></div>
|
||||
<div id="no_progress" style="border: solid #cbcbcb 1px;height:150px;overflow:scroll;padding:2px;"></div>
|
||||
<%block name="return_bottom_block"></%block>
|
||||
</%block>
|
||||
<%block name="jscript_block">
|
||||
<script language="Javascript" src="${make_media_url('js/jquery-ui.min.js', 'pastafari2')}"></script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue