Fixes in scripts for use native python

This commit is contained in:
absurdo 2023-11-25 19:48:47 +01:00
parent 205ff97ce3
commit def162c1c9
9 changed files with 28 additions and 27 deletions

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
import sys, os import sys, os
import subprocess import subprocess

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
import sys import sys
import subprocess import subprocess
@ -160,4 +160,5 @@ if subprocess.call("sudo echo 'mariadb-server mariadb-server/root_password_again
sys.exit(1) sys.exit(1)
""" """
print('Setted the password') #print('Setted the password')
print('Mariadb installed!')

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
import sys import sys
import argparse import argparse

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
# A script for install pzoo user # A script for install pzoo user

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
# A script for install pzoo user # A script for install pzoo user

View file

@ -20,7 +20,7 @@ elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
pacman -Syu --noconfirm sudo pacman -Syu --noconfirm sudo
sudo pacman -S --noconfirm python python-pip sudo augeas python-virtualenv sudo pacman -S --noconfirm python python-pip sudo augeas python-virtualenv python-distro
elif [[ $DISTRO =~ ^NAME=\"Rocky ]] || [[ $DISTRO =~ ^Alma ]]; then elif [[ $DISTRO =~ ^NAME=\"Rocky ]] || [[ $DISTRO =~ ^Alma ]]; then
@ -28,7 +28,7 @@ elif [[ $DISTRO =~ ^NAME=\"Rocky ]] || [[ $DISTRO =~ ^Alma ]]; then
sudo dnf upgrade -y sudo dnf upgrade -y
sudo dnf install -y python python-pip sudo augeas-libs sudo dnf install -y python python-pip sudo augeas-libs python3-distro
#Install EPEL #Install EPEL
dnf config-manager --set-enabled crb dnf config-manager --set-enabled crb
sudo dnf install -y \ sudo dnf install -y \
@ -42,7 +42,7 @@ elif [[ $DISTRO =~ ^Fedora ]]; then
sudo dnf upgrade -y sudo dnf upgrade -y
sudo dnf install -y python3 python3-pip sudo augeas-libs sudo dnf install -y python3 python3-pip sudo augeas-libs python3-distro
else else
@ -66,36 +66,36 @@ else
fi fi
echo '{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Installing distro package for python and detect distribution..."}' # echo '{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Installing distro package for python and detect distribution..."}'
# Install virtualenv python and give source in profile. # Install virtualenv python and give source in profile.
sudo python3 -m venv /opt/pythonenv/ # sudo python3 -m venv /opt/pythonenv/
sudo /opt/pythonenv/bin/pip install --upgrade pip # sudo /opt/pythonenv/bin/pip install --upgrade pip
#echo "export PS_REAL=\$PS1 && source /opt/pythonenv/bin/activate && export PS1=\$PS_REAL && export PYTHONUNBUFFERED=1" >> /etc/profile.d/zpythonenv.sh #echo "export PS_REAL=\$PS1 && source /opt/pythonenv/bin/activate && export PS1=\$PS_REAL && export PYTHONUNBUFFERED=1" >> /etc/profile.d/zpythonenv.sh
#echo "export PYTHONUNBUFFERED=1" >> /etc/profile.d/pythonenv.sh #echo "export PYTHONUNBUFFERED=1" >> /etc/profile.d/pythonenv.sh
sleep 1 # sleep 1
sudo /opt/pythonenv/bin/pip3 install distro # sudo /opt/pythonenv/bin/pip3 install distro
if [ $? -eq 0 ]; then # if [ $? -eq 0 ]; then
#echo "Installed python3 sucessfully if not error..." #echo "Installed python3 sucessfully if not error..."
echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Installed distro python package sucessfully..."}' #echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Installed distro python package sucessfully..."}'
sleep 1 #sleep 1
else #else
echo "Sorry, cannot install distro python package..." # echo "Sorry, cannot install distro python package..."
exit 1; #exit 1;
fi #fi
sleep 1 sleep 1

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
# A script for install pzoo user # A script for install pzoo user

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
# A script for install pzoo user # A script for install pzoo user

View file

@ -11,10 +11,10 @@ class ServerTask(Task):
self.files=[['modules/pastafari2/scripts/system/install_pzoo_stats.py', 0o755]] self.files=[['modules/pastafari2/scripts/system/install_pzoo_stats.py', 0o755]]
self.files.append(['modules/pastafari2/scripts/system/install_python.sh', 0o755]) 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_psutil.sh', 0o755])
self.files.append(['modules/pastafari2/scripts/system/install_git.py', 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_php.py', 0o755])
self.files.append(['modules/pastafari2/scripts/system/install_unixutils.sh', 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(['modules/pastafari2/scripts/system/sudoers.d/spanel', 0o640])
self.files.append([self.data['pub_key'], 0o600]) self.files.append([self.data['pub_key'], 0o600])
@ -25,8 +25,8 @@ class ServerTask(Task):
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_python.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_git.py', ''])
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_php.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_unixutils.sh', ''])
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', '']) #self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', ''])
#' --url_stats='+self.data['url_stats']+ #' --url_stats='+self.data['url_stats']+