Fixes in install
This commit is contained in:
parent
1a20fdd944
commit
43f69c6c2d
6 changed files with 76 additions and 26 deletions
47
scripts/system/install_pastafariutils.py
Normal file
47
scripts/system/install_pastafariutils.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/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 json
|
||||
|
||||
#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_pastafariutils.py', description='Add pastafariutils for a system user')
|
||||
|
||||
parser.add_argument('--user', help='The user used for install pastafariutils', required=True)
|
||||
|
||||
args=parser.parse_args()
|
||||
|
||||
user=args.user
|
||||
|
||||
# https://git.cuchulu.com/paramecio/pastafariutils.git
|
||||
# python3 -m venv /home/{}/pythonenv/ && source /home/{}/pythonenv/bin/activate && pip3 install git+https://git.cuchulu.com/paramecio/pastafariutils.git
|
||||
|
||||
if subprocess.call("sudo su - {} -s /bin/bash -c 'cd /home/{} && python3 -m venv /home/{}/pythonenv/ && . /home/{}/pythonenv/bin/activate && pip3 install git+https://git.cuchulu.com/paramecio/pastafariutils.git && pip3 install distro'".format(user, user, user, user), shell=True) > 0:
|
||||
print('Error, cannot install pastafariutils...')
|
||||
exit(1)
|
||||
|
||||
print("pastafariutils installed...")
|
||||
|
||||
# #{'result': 1, 'message': {'username': 'hosting', 'uid': 1002, 'gid': 1002, 'home': '/srv/sites'}, 'error': 0, 'progress': 100, 'task_id': 483, 'server': '192.168.122.55'}
|
||||
#json_code['message']=json.dumps(json_code['message'])
|
||||
|
||||
print(json.dumps({'error': 0, 'status': 1, 'progress': 100, 'no_progress':0, 'message': '{"distro": "'+distro.id()+'"}', 'result': 1}))
|
||||
|
||||
#print('{"error": 0, "status": 1, "progress": 100, "no_progress":0, "message": "{\\"distro\\": \\"'+distro.id()+'\\"}", "result": 1}')
|
||||
|
|
@ -13,8 +13,8 @@ DISTRO=`( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head
|
|||
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 python3-distro
|
||||
apt-get -y install sudo
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get -y install python3 python3-full python3-pip python3-venv libaugeas0 python3-distro
|
||||
|
||||
elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue