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 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
apt-get -qq purge mysql* graphviz* redis*
apt-get install -qq git python3-setuptools python3-dev python3-apt ccze tree
@@ -33,7 +53,7 @@ for stack in $stack_list; do
echo -ne " Installing $stack [..]\r"
if {
wo stack install --${stack}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Installing $stack [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -52,7 +72,7 @@ for site in $site_types; do
echo -ne " Creating $site [..]\r"
if {
wo site create ${site}.net --${site}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Creating $site [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -70,7 +90,7 @@ for site in $other_site_types; do
echo -ne " Updating site to $site php73 [..]\r"
if {
wo site update ${site}.net --php73
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -86,12 +106,12 @@ echo -e ' wo site update WP '
echo -e "${CGREEN}#############################################${CEND}"
wp_site_types='wpfc wpsc wpce wprocket wpredis'
wo site create wp.io --wp >> /dev/null 2>&1
wo site create wp.io --wp >>/dev/null 2>&1
for site in $wp_site_types; do
echo -ne " Updating WP to $site [..]\r"
if {
wo site update wp.io --${site}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Updating WP to $site [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -111,7 +131,7 @@ for site in $wp_site_types; do
echo -ne " Creating wpsubdir $site [..]\r"
if {
wo site create wpsubdir"$site".io --wpsubdir --${site}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Creating wpsubdir $site [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -131,7 +151,7 @@ for site in $wp_site_types; do
echo -ne " Creating wpsubdomain $site [..]\r"
if {
wo site create wpsubdomain"$site".io --wpsubdomain --${site}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Creating wpsubdomain $site [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -150,7 +170,7 @@ if [ -z "$1" ]; then
echo -ne " Upgrading $stack [..]\r"
if {
wo stack upgrade --${stack} --force
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " Upgrading $stack [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -169,7 +189,7 @@ for stack in $stack_clean; do
echo -ne " cleaning $stack cache [..]\r"
if {
wo clean --${stack}
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " cleaning $stack cache [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -186,7 +206,7 @@ echo -e "${CGREEN}#############################################${CEND}"
echo -ne " wo secure --auth [..]\r"
if {
wo secure --auth wordops mypassword
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " wo secure --auth [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -198,7 +218,7 @@ fi
echo -ne " wo secure --sshport [..]\r"
if {
wo secure --sshport 2022
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " wo secure --sshport [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -210,7 +230,7 @@ fi
echo -ne " wo secure --ssh [..]\r"
if {
wo secure --ssh --force
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " wo secure --ssh [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
@@ -235,7 +255,7 @@ for stack in $stack_purge; do
echo -ne " purging $stack [..]\r"
if {
wo stack purge --${stack} --force
} >> /var/log/wo/test.log; then
} >>/var/log/wo/test.log; then
echo -ne " purging $stack [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else

View File

@@ -87,6 +87,9 @@ class WOStackController(CementBaseController):
action='store_true')),
(['--cheat'],
dict(help='Install cheat.sh', action='store_true')),
(['--nanorc'],
dict(help='Install nanorc syntax highlightning',
action='store_true')),
(['--force'],
dict(help='Force install/remove/purge without prompt',
action='store_true')),
@@ -118,7 +121,7 @@ class WOStackController(CementBaseController):
(not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) 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.phpredisadmin) and (not pargs.sendmail) and
(not pargs.php73)):
@@ -459,6 +462,16 @@ class WOStackController(CementBaseController):
"/etc/bash_completion.d/cht.sh",
"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
if pargs.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.redis) and (not pargs.proftpd) 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.phpredisadmin) and (not pargs.sendmail) and
(not pargs.php73)):
@@ -573,6 +586,7 @@ class WOStackController(CementBaseController):
pargs.utils = True
pargs.redis = True
pargs.security = True
pargs.nanorc = True
packages = packages + ['/var/www/22222/htdocs']
if pargs.web:
@@ -825,7 +839,7 @@ class WOStackController(CementBaseController):
(not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) 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.phpredisadmin) and (not pargs.sendmail) and
(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_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):
"""Post activity after installation of packages"""

View File

@@ -37,6 +37,27 @@ class WOShellExec():
Log.debug(self, str(e))
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=''):
"""
Open files using sensible editor

View File

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