add argument parsing to install script
This commit is contained in:
@@ -26,7 +26,7 @@ script:
|
|||||||
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
|
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
|
||||||
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
|
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
|
||||||
- sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze tree
|
- sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze tree
|
||||||
- sudo bash install $TRAVIS_BRANCH
|
- sudo bash install -b $TRAVIS_BRANCH
|
||||||
- sudo wo --help && sudo wo stack install && sudo wo stack install --admin
|
- sudo wo --help && sudo wo stack install && sudo wo stack install --admin
|
||||||
|
|
||||||
- sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log
|
- sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log
|
||||||
|
|||||||
44
install
44
install
@@ -78,13 +78,29 @@ if [ -z "$(command -v lsb_release)" ]; then
|
|||||||
apt-get -y install lsb-release -qq
|
apt-get -y install lsb-release -qq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-b | --branch)
|
||||||
|
wo_branch="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p | --preserve)
|
||||||
|
wo_preserve_config="y"
|
||||||
|
;;
|
||||||
|
--force)
|
||||||
|
wo_force_install="y"
|
||||||
|
;;
|
||||||
|
*) # positional args
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
###
|
###
|
||||||
# 1 - Define variables for later use
|
# 1 - Define variables for later use
|
||||||
###
|
###
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$wo_branch" ]; then
|
||||||
wo_branch=master
|
wo_branch=master
|
||||||
else
|
|
||||||
wo_branch="$1"
|
|
||||||
fi
|
fi
|
||||||
readonly wo_log_dir=/var/log/wo/
|
readonly wo_log_dir=/var/log/wo/
|
||||||
readonly wo_backup_dir=/var/lib/wo-backup/
|
readonly wo_backup_dir=/var/lib/wo-backup/
|
||||||
@@ -107,6 +123,7 @@ fi
|
|||||||
###
|
###
|
||||||
# 1 - Checking linux distro
|
# 1 - Checking linux distro
|
||||||
###
|
###
|
||||||
|
if [ -z "$wo_force_install" ]; then
|
||||||
if [ "$wo_linux_distro" != "Ubuntu" ] && [ "$wo_linux_distro" != "Debian" ]; then
|
if [ "$wo_linux_distro" != "Ubuntu" ] && [ "$wo_linux_distro" != "Debian" ]; then
|
||||||
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu and Debian at the moment."
|
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu and Debian at the moment."
|
||||||
wo_lib_echo_fail "If you are feeling adventurous, you are free to fork WordOps to support"
|
wo_lib_echo_fail "If you are feeling adventurous, you are free to fork WordOps to support"
|
||||||
@@ -119,6 +136,7 @@ else
|
|||||||
exit 100
|
exit 100
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
# 1 - To prevent errors or unexpected behaviour, create the log and ACL it
|
# 1 - To prevent errors or unexpected behaviour, create the log and ACL it
|
||||||
@@ -364,17 +382,19 @@ wo_install_acme_sh() {
|
|||||||
|
|
||||||
} >> "$wo_install_log" 2>&1
|
} >> "$wo_install_log" 2>&1
|
||||||
fi
|
fi
|
||||||
if [ -d "$HOME/.acme/.sh" ]; then
|
if [ -d "$HOME/.acme.sh" ]; then
|
||||||
{
|
{
|
||||||
rsync -az --exclude="account.conf" \
|
/usr/bin/rsync -rltgoDpz --exclude="account.conf" \
|
||||||
--exclude="acme.sh" \
|
--exclude="acme.sh" \
|
||||||
--exclude="acme.sh.env" \
|
--exclude="acme.sh.env" \
|
||||||
--exclude="deploy" \
|
--exclude="deploy" \
|
||||||
--exclude="dnsapi" \
|
--exclude="dnsapi" \
|
||||||
--exclude="http.header" \
|
--exclude="http.header" \
|
||||||
--exclude="ca" \
|
--exclude="ca" \
|
||||||
|
--del \
|
||||||
"$HOME/.acme.sh/" \
|
"$HOME/.acme.sh/" \
|
||||||
/etc/letsencrypt/renewal/
|
/etc/letsencrypt/renewal/
|
||||||
|
|
||||||
} >> "$wo_install_log" 2>&1
|
} >> "$wo_install_log" 2>&1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -386,7 +406,7 @@ wo_install() {
|
|||||||
rm -rf /tmp/WordOps
|
rm -rf /tmp/WordOps
|
||||||
git clone https://github.com/WordOps/WordOps.git /tmp/WordOps -b "$wo_branch"
|
git clone https://github.com/WordOps/WordOps.git /tmp/WordOps -b "$wo_branch"
|
||||||
else
|
else
|
||||||
git -C /tmp/WordOps pull
|
git -C /tmp/WordOps pull origin "$wo_branch"
|
||||||
fi
|
fi
|
||||||
cd /tmp/WordOps || exit 1
|
cd /tmp/WordOps || exit 1
|
||||||
} >> "$wo_install_log" 2>&1
|
} >> "$wo_install_log" 2>&1
|
||||||
@@ -630,10 +650,8 @@ if [ -x /usr/local/bin/wo ]; then
|
|||||||
wo_upgrade_nginx | tee -ai $wo_install_log
|
wo_upgrade_nginx | tee -ai $wo_install_log
|
||||||
fi
|
fi
|
||||||
wo_update_latest | tee -ai $wo_install_log
|
wo_update_latest | tee -ai $wo_install_log
|
||||||
if [ ! -d /opt/acme.sh ]; then
|
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
wo_install_acme_sh | tee -ai $wo_install_log
|
||||||
wo_install_acme_sh | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
||||||
wo_git_init | tee -ai $wo_install_log
|
wo_git_init | tee -ai $wo_install_log
|
||||||
wo_update_wp_cli | tee -ai $wo_install_log
|
wo_update_wp_cli | tee -ai $wo_install_log
|
||||||
@@ -662,10 +680,8 @@ else
|
|||||||
wo_upgrade_nginx | tee -ai $wo_install_log
|
wo_upgrade_nginx | tee -ai $wo_install_log
|
||||||
fi
|
fi
|
||||||
wo_update_latest | tee -ai $wo_install_log
|
wo_update_latest | tee -ai $wo_install_log
|
||||||
if [ ! -d /opt/acme.sh ]; then
|
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
wo_install_acme_sh | tee -ai $wo_install_log
|
||||||
wo_install_acme_sh | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
||||||
wo_git_init | tee -ai $wo_install_log
|
wo_git_init | tee -ai $wo_install_log
|
||||||
wo_update_wp_cli | tee -ai $wo_install_log
|
wo_update_wp_cli | tee -ai $wo_install_log
|
||||||
|
|||||||
Reference in New Issue
Block a user