Added support for php, composer, and php utilities
This commit is contained in:
parent
def162c1c9
commit
929a13eb88
5 changed files with 91 additions and 5 deletions
32
scripts/system/install_composer.sh
Normal file
32
scripts/system/install_composer.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
echo "Installing composer..."
|
||||
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
|
||||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
|
||||
then
|
||||
>&2 echo 'ERROR: Invalid installer checksum'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
|
||||
echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Composer installed sucessfully..."}'
|
||||
|
||||
else
|
||||
echo '{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: cannot install composer!"}'
|
||||
|
||||
exit 1
|
||||
|
||||
fi
|
||||
36
scripts/system/install_leviathanutils.py
Normal file
36
scripts/system/install_leviathanutils.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/python3 -u
|
||||
|
||||
import sys, os
|
||||
import subprocess
|
||||
import argparse
|
||||
import platform
|
||||
import shutil
|
||||
import pathlib
|
||||
import distro
|
||||
import pwd
|
||||
import getpass
|
||||
import re
|
||||
import platform
|
||||
|
||||
#import pymysql.cursors
|
||||
#pymysql.install_as_MySQLdb
|
||||
|
||||
pyv=platform.python_version_tuple()
|
||||
|
||||
if pyv[0]!='3':
|
||||
print('Need python 3 for execute this script')
|
||||
sys.exit(1)
|
||||
|
||||
parser=argparse.ArgumentParser(prog='install_leviathanutils.py', description='Add leviathanutils for a system user')
|
||||
|
||||
parser.add_argument('--user', help='The user used for install leviathanutils', required=True)
|
||||
|
||||
args=parser.parse_args()
|
||||
|
||||
user=args.user
|
||||
|
||||
if subprocess.call("cd /home/{} && git clone https://git.cuchulu.com/phangoapp/leviathanutils.git && COMPOSER_ALLOW_SUPERUSER=1 composer install --working-dir=/home/{}/leviathanutils && chown -R {}:{} /home/{}/leviathanutils".format(user, user, user, user, user), shell=True) > 0:
|
||||
print('Error, cannot install leviathanutils...')
|
||||
exit(1)
|
||||
|
||||
print("Leviathanutils installed...")
|
||||
|
|
@ -14,7 +14,7 @@ if [[ $DISTRO =~ ^Debian ]] || [[ $DISTRO =~ ^Ubuntu ]]; then
|
|||
|
||||
apt-get update
|
||||
apt-get install sudo
|
||||
sudo apt-get -y install python3 python3-full python3-pip python3-venv libaugeas0
|
||||
sudo apt-get -y install python3 python3-full python3-pip python3-venv libaugeas0 python3-distro
|
||||
|
||||
elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
|
||||
|
||||
|
|
|
|||
|
|
@ -36,3 +36,20 @@ elif linux_distro=='rocky' or linux_distro=='fedora' or linux_distro=='alma' or
|
|||
print('Error, cannot upgrade server...')
|
||||
exit(1)
|
||||
|
||||
# Need update certbot and leviathanutils.
|
||||
|
||||
print('Upgrading certbot...')
|
||||
|
||||
#/opt/certbot/bin/pip install --upgrade certbot
|
||||
|
||||
if call("sudo /opt/certbot/bin/pip install --upgrade certbot", shell=True) > 0:
|
||||
print('Error, cannot upgrade certbot...')
|
||||
exit(1)
|
||||
|
||||
print('Upgrading Pastafari utils...')
|
||||
|
||||
print('Upgrading Composer...')
|
||||
|
||||
if call("sudo /usr/local/bin/composer self-update", shell=True) > 0:
|
||||
print('Error, cannot upgrade composer...')
|
||||
exit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue