From 3136671525581f4497f1396bc8da0415726cf291 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 30 Aug 2019 21:09:10 +0200 Subject: [PATCH] Add cheat.sh --- install | 20 +++++++++++--------- wo/cli/plugins/stack.py | 24 +++--------------------- wo/cli/plugins/stack_pref.py | 5 ----- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/install b/install index 8a2ed15..f34f842 100755 --- a/install +++ b/install @@ -725,12 +725,6 @@ wo_uninstall() { rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates >> /var/log/wo/install.log 2>&1 } -wo_cheat_alias() { - if ! grep -q "cheat" "$HOME/.bashrc"; then - echo "alias cheat='/usr/local/bin/cht.sh'" >> "$HOME/.bashrc" - fi -} - wo_ufw_setup() { # get custom ssh port @@ -796,6 +790,14 @@ wo_ufw_setup() { } \ >> $wo_install_log +wo_cheat_install() { + curl -sL https://cht.sh/:cht.sh > /usr/local/bin/cht.sh + curl -sL https://cheat.sh/:bash_completion > /etc/bash_completion.d/cht.sh + if ! grep -q "cheat" $HOME/.bashrc; then + echo "alias cheat='/usr/local/bin/cht.sh'" >> "$HOME/.bashrc" + fi +} + ### # 4 - WO MAIN SETUP ### @@ -849,7 +851,7 @@ else if [ -d /etc/systemd/system/mariadb.service.d ]; then wo_mariadb_tweak | tee -ai $wo_install_log fi - wo_cheat_alias | tee -ai $wo_install_log + wo_cheat_install | tee -ai $wo_install_log wo_domain_suffix | tee -ai $wo_install_log wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log wo_update_wp_cli | tee -ai $wo_install_log @@ -902,7 +904,7 @@ else wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log wo_git_init | tee -ai $wo_install_log wo_update_wp_cli | tee -ai $wo_install_log - wo_cheat_alias | tee -ai $wo_install_log + wo_cheat_install | tee -ai $wo_install_log wo_lib_echo "Cleaning-up EE previous install" | tee -ai $wo_install_log wo_clean_ee | tee -ai $wo_install_log else @@ -937,7 +939,7 @@ else wo_install_acme_sh | tee -ai $wo_install_log wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log secure_wo_db | tee -ai $wo_install_log - wo_cheat_alias | tee -ai $wo_install_log + wo_cheat_install | tee -ai $wo_install_log wo_domain_suffix | tee -ai $wo_install_log wo_git_init | tee -ai $wo_install_log wo_update_wp_cli | tee -ai $wo_install_log diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 39b6d2f..c829708 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -90,8 +90,6 @@ class WOStackController(CementBaseController): dict(help='Install ClamAV stack', action='store_true')), (['--utils'], dict(help='Install Utils stack', action='store_true')), - (['--cheat'], - dict(help='Install cheat.sh stack', action='store_true')), (['--redis'], dict(help='Install Redis', action='store_true')), (['--phpredisadmin'], @@ -127,8 +125,7 @@ class WOStackController(CementBaseController): (not pargs.mysqlclient) and (not pargs.mysqltuner) and (not pargs.adminer) and (not pargs.utils) and (not pargs.redis) and (not pargs.proftpd) and - (not pargs.extplorer) and - (not pargs.cheat) and (not pargs.clamav) and + (not pargs.extplorer) and (not pargs.clamav) and (not pargs.phpredisadmin) and (not pargs.php73)): pargs.web = True @@ -158,7 +155,6 @@ class WOStackController(CementBaseController): pargs.dashboard = True pargs.phpredisadmin = True pargs.extplorer = True - pargs.cheat = True if pargs.security: pargs.fail2ban = True @@ -417,17 +413,6 @@ class WOStackController(CementBaseController): Log.debug(self, "eXtplorer is already installed") Log.info(self, "eXtplorer is already installed") - # cheat.sh - if pargs.cheat: - if not os.path.isfile('/usr/local/bin/cht.sh'): - Log.debug(self, "Setting packages variable for cht.sh") - packages = packages + [["https://cht.sh/:cht.sh", - "/usr/local/bin/cht.sh", - "cheat.sh"]] - else: - Log.debug(self, "cheat.sh is already installed") - Log.info(self, "cheat.sh is already installed") - # UTILS if pargs.utils: Log.debug(self, "Setting packages variable for utils") @@ -516,8 +501,7 @@ class WOStackController(CementBaseController): (not pargs.mysqlclient) and (not pargs.mysqltuner) and (not pargs.adminer) and (not pargs.utils) and (not pargs.redis) and (not pargs.proftpd) and - (not pargs.extplorer) and - (not pargs.cheat) and (not pargs.clamav) and + (not pargs.extplorer) and (not pargs.clamav) and (not pargs.phpredisadmin) and (not pargs.php73)): pargs.web = True @@ -723,8 +707,7 @@ class WOStackController(CementBaseController): (not pargs.mysqlclient) and (not pargs.mysqltuner) and (not pargs.adminer) and (not pargs.utils) and (not pargs.redis) and (not pargs.proftpd) and - (not pargs.extplorer) and - (not pargs.cheat) and (not pargs.clamav) and + (not pargs.extplorer) and (not pargs.clamav) and (not pargs.phpredisadmin) and (not pargs.php73)): pargs.web = True @@ -752,7 +735,6 @@ class WOStackController(CementBaseController): pargs.composer = True pargs.netdata = True pargs.mysqltuner = True - pargs.cheat = True if pargs.security: pargs.fail2ban = True diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 5400b47..2be7ad9 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -1482,11 +1482,6 @@ def post_pref(self, apt_packages, packages, upgrade=False): for x in packages): WOFileUtils.chmod(self, "/usr/bin/pt-query-advisor", 0o775) - # cht.sh - if any('/usr/local/bin/cht.sh' == x[1] - for x in packages): - WOFileUtils.chmod(self, "/usr/local/bin/cht.sh", 0o775) - # phpredisadmin if any('/var/lib/wo/tmp/pra.tar.gz' == x[1] for x in packages):