This commit is contained in:
VirtuBox
2019-10-31 15:42:42 +01:00
parent f202116249
commit 23be601c11
5 changed files with 83 additions and 16 deletions

View File

@@ -14,6 +14,26 @@ unset LANG
export LANG='en_US.UTF-8' export LANG='en_US.UTF-8'
export LC_ALL='C.UTF-8' export LC_ALL='C.UTF-8'
if [ "$PWD" != "/home/travis" ]; then
sudo rm -rf /etc/mysql
unset LANG
if ! {
apt-get update --allow-releaseinfo-change -qq
}; then
apt-get update -qq
fi
sudo apt-get -qq purge mysql* graphviz* redis*
sudo apt-get -qq autoremove --purge
lsb_release -a
sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
sudo echo "Travis Banch = $TRAVIS_BRANCH"
time bash install --travis -b "$TRAVIS_BRANCH"
python3 -m pip install -U -r requirements.txt
time bash tests/travis.sh
wo update --travis
python3 setup.py sdist bdist_wheel
fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
apt-get -qq purge mysql* graphviz* redis* apt-get -qq purge mysql* graphviz* redis*
apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree

View File

@@ -87,6 +87,9 @@ class WOStackController(CementBaseController):
action='store_true')), action='store_true')),
(['--cheat'], (['--cheat'],
dict(help='Install cheat.sh', action='store_true')), dict(help='Install cheat.sh', action='store_true')),
(['--nanorc'],
dict(help='Install nanorc syntax highlightning',
action='store_true')),
(['--force'], (['--force'],
dict(help='Force install/remove/purge without prompt', dict(help='Force install/remove/purge without prompt',
action='store_true')), action='store_true')),
@@ -118,7 +121,7 @@ class WOStackController(CementBaseController):
(not pargs.adminer) and (not pargs.utils) and (not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) and (not pargs.redis) and (not pargs.proftpd) and
(not pargs.extplorer) and (not pargs.clamav) and (not pargs.extplorer) and (not pargs.clamav) and
(not pargs.cheat) and (not pargs.cheat) and (not pargs.nanorc) and
(not pargs.ufw) and (not pargs.ngxblocker) and (not pargs.ufw) and (not pargs.ngxblocker) and
(not pargs.phpredisadmin) and (not pargs.sendmail) and (not pargs.phpredisadmin) and (not pargs.sendmail) and
(not pargs.php73)): (not pargs.php73)):
@@ -459,6 +462,16 @@ class WOStackController(CementBaseController):
"/etc/bash_completion.d/cht.sh", "/etc/bash_completion.d/cht.sh",
"bash_completion"]] "bash_completion"]]
if pargs.nanorc:
if not os.path.exists('/usr/share/nano-syntax-highlighting'):
Log.debug(self, "Setting packages variable for nanorc")
apt_packages = apt_packages + ['nano']
packages = [
['https://github.com/scopatz/nanorc/archive/master.tar.gz',
'/var/lib/wo/tmp/nanorc.tar.gz',
'nanorc']]
# UTILS # UTILS
if pargs.utils: if pargs.utils:
Log.debug(self, "Setting packages variable for utils") Log.debug(self, "Setting packages variable for utils")
@@ -557,7 +570,7 @@ class WOStackController(CementBaseController):
(not pargs.adminer) and (not pargs.utils) and (not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) and (not pargs.redis) and (not pargs.proftpd) and
(not pargs.extplorer) and (not pargs.clamav) and (not pargs.extplorer) and (not pargs.clamav) and
(not pargs.cheat) and (not pargs.cheat) and (not pargs.nanorc) and
(not pargs.ufw) and (not pargs.ngxblocker) and (not pargs.ufw) and (not pargs.ngxblocker) and
(not pargs.phpredisadmin) and (not pargs.sendmail) and (not pargs.phpredisadmin) and (not pargs.sendmail) and
(not pargs.php73)): (not pargs.php73)):
@@ -573,6 +586,7 @@ class WOStackController(CementBaseController):
pargs.utils = True pargs.utils = True
pargs.redis = True pargs.redis = True
pargs.security = True pargs.security = True
pargs.nanorc = True
packages = packages + ['/var/www/22222/htdocs'] packages = packages + ['/var/www/22222/htdocs']
if pargs.web: if pargs.web:
@@ -825,7 +839,7 @@ class WOStackController(CementBaseController):
(not pargs.adminer) and (not pargs.utils) and (not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) and (not pargs.redis) and (not pargs.proftpd) and
(not pargs.extplorer) and (not pargs.clamav) and (not pargs.extplorer) and (not pargs.clamav) and
(not pargs.cheat) and (not pargs.cheat) and (not pargs.nanorc) and
(not pargs.ufw) and (not pargs.ngxblocker) and (not pargs.ufw) and (not pargs.ngxblocker) and
(not pargs.phpredisadmin) and (not pargs.sendmail) and (not pargs.phpredisadmin) and (not pargs.sendmail) and
(not pargs.php73)): (not pargs.php73)):

View File

@@ -165,6 +165,17 @@ def pre_pref(self, apt_packages):
WORepo.add(self, repo_url=WOVar.wo_php_repo) WORepo.add(self, repo_url=WOVar.wo_php_repo)
WORepo.add_key(self, WOVar.wo_nginx_key) WORepo.add_key(self, WOVar.wo_nginx_key)
# nano
if 'nano' in apt_packages:
if WOVar.wo_distro == 'ubuntu':
if (WOVar.wo_platform_codename == 'bionic' or
WOVar.wo_platform_codename == 'xenial'):
if not os.path.exists(
'jonathonf-ubuntu-backports-{0}.list'
.format(WOVar.wo_platform_codename)):
Log.debug(self, 'Adding ppa for nano')
WORepo.add(self, repo_url=WOVar.wo_ubuntu_backports)
def post_pref(self, apt_packages, packages, upgrade=False): def post_pref(self, apt_packages, packages, upgrade=False):
"""Post activity after installation of packages""" """Post activity after installation of packages"""

View File

@@ -37,6 +37,27 @@ class WOShellExec():
Log.debug(self, str(e)) Log.debug(self, str(e))
raise CommandExecutionError raise CommandExecutionError
def cmd_exist(self, command):
"""Check if a command exist with command -v"""
try:
Log.debug(self, "Testing command: {0}".format(command))
testing_command = ("command -v {0}".format(command))
with subprocess.Popen([testing_command], stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True) as proc:
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate()
(cmd_stdout, cmd_stderr) = (
cmd_stdout_bytes.decode('utf-8', "replace"),
cmd_stderr_bytes.decode('utf-8', "replace"))
Log.debug(self, "Command Output: {0}, \nCommand Error: {1}"
.format(cmd_stdout, cmd_stderr))
return bool(proc.returncode == 0)
except OSError as e:
Log.debug(self, str(e))
raise CommandExecutionError
except Exception as e:
Log.debug(self, str(e))
raise CommandExecutionError
def invoke_editor(self, filepath, errormsg=''): def invoke_editor(self, filepath, errormsg=''):
""" """
Open files using sensible editor Open files using sensible editor

View File

@@ -163,6 +163,7 @@ class WOVar():
wo_fail2ban = ["fail2ban"] wo_fail2ban = ["fail2ban"]
wo_clamav = ["clamav", "clamav-freshclam"] wo_clamav = ["clamav", "clamav-freshclam"]
wo_ubuntu_backports = 'ppa:jonathonf/backports'
# Redis repo details # Redis repo details
if wo_distro == 'ubuntu': if wo_distro == 'ubuntu':