#!/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...")