From 3ba5927c3a9e0553ea3684cfeadc0464974fa6b3 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 24 Jul 2019 14:22:27 +0200 Subject: [PATCH] Improve install script --- install | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/install b/install index 4cd4d21..4d0a4e5 100755 --- a/install +++ b/install @@ -175,19 +175,20 @@ wo_install_dep() { [ -z "$wo_travis" ] && { # update server packages - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y dist-upgrade - } > /dev/null 2>&1 + DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet + } if [ "$wo_linux_distro" == "Ubuntu" ]; then # install dependencies - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1 + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" --assume-yes install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1 else + # install dependencies + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" --assume-yes install build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-dev ca-certificates sqlite3 git tar software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1 + # add php repository gpg key + [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } # add nginx repository gpg key wget https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key -O Release.key apt-key add - < Release.key rm -f Release.key - # install dependencies - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-dev ca-certificates sqlite3 git tar software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw > /dev/null 2>&1 - [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } fi locale-gen en @@ -405,18 +406,21 @@ wo_install() { { rm -f /etc/bash_completion.d/wo_auto.rc rm -rf /tmp/WordOps - git clone https://github.com/WordOps/WordOps.git /tmp/WordOps -b "$wo_branch" + git clone -b "$wo_branch" --depth=50 https://github.com/WordOps/WordOps.git /tmp/WordOps cd /tmp/WordOps || exit 1 } \ >> "$wo_install_log" 2>&1 + if [ "$wo_force_install" = "y" ]; then + [ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; } + fi + if [ -f "$HOME/.gitconfig" ]; then + # install and redirect log to not print python package install python3 setup.py install >> $wo_install_log 2>&1 else - if [ "$wo_force_install" = "y" ]; then - [ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME" > $HOME/.gitconfig'; } - fi + # install without redirecting logs to prompt user for name & email python3 setup.py install fi @@ -444,17 +448,16 @@ wo_upgrade_nginx() { # add new Nginx repository if [ "$wo_linux_distro" = "Ubuntu" ]; then + if [ ! -f /etc/apt/sources.list.d/wordops-ubuntu-nginx-wo-"$(lsb_release -sc)".list ]; then add-apt-repository ppa:wordops/nginx-wo -y -u + fi else if [ "$wo_distro_version" == "jessie" ]; then - wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_8.0/Release.key + curl -sL https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_8.0/Release.key | apt-key add - else - wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key + curl -sL https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key | apt-key add - fi # import the respository key for updates - apt-key add - < /tmp/nginx-wo.key - rm -f /tmp/nginx-wo.key - apt-get update -qq fi # stop nginx @@ -637,7 +640,7 @@ wo_tweak_kernel() { if [ ! -f /etc/sysctl.d/60-wo-tweaks.conf ]; then if [ "$WO_ARCH" = "x86_64" ]; then rm -f /etc/sysctl.d/60-ubuntu-nginx-web-server.conf - wget -qO /etc/sysctl.d/60-wo-tweaks.conf https://raw.githubusercontent.com/WordOps/WordOps/updating-configuration/wo/cli/templates/sysctl.mustache + wget -qO /etc/sysctl.d/60-wo-tweaks.conf https://raw.githubusercontent.com/WordOps/WordOps/master/wo/cli/templates/sysctl.mustache if [ "$wo_distro_version" = "bionic" ] || [ "$wo_distro_version" = "disco" ] || [ "$wo_distro_version" = "buster" ]; then modprobe tcp_bbr && echo 'tcp_bbr' >> /etc/modules-load.d/bbr.conf echo -e '\nnet.ipv4.tcp_congestion_control = bbr\nnet.ipv4.tcp_notsent_lowat = 16384' >> /etc/sysctl.d/60-wo-tweaks.conf @@ -774,6 +777,7 @@ elif [ "$wo_upgrade" = "1" ]; then else wo_lib_echo "WordOps (wo) installed successfully" fi +echo wo_lib_echo_info "For autocompletion, run the following command:" wo_lib_echo_info "source /etc/bash_completion.d/wo_auto.rc" echo