update nginx_upgrade in install script
This commit is contained in:
41
install
41
install
@@ -222,12 +222,12 @@ wo_sync_db()
|
||||
|
||||
if [ "$(echo "$wo_site_current_type" | grep php)" ]; then
|
||||
if [ "$(echo "$wo_site_current_type" | grep php7)" ]; then
|
||||
php_version="7.0"
|
||||
wo_php_version="7.0"
|
||||
else
|
||||
php_version="5.6"
|
||||
wo_php_version="5.6"
|
||||
fi
|
||||
else
|
||||
php_version=""
|
||||
wo_php_version=""
|
||||
fi
|
||||
|
||||
if [ "$(echo "$wo_site_current_type" | grep redis)" ]; then
|
||||
@@ -271,7 +271,6 @@ wo_sync_db()
|
||||
VALUES (\"$site\", \"$wo_site_current\", \"$wo_site_current_cache\", \"$wo_webroot\", \"$wo_site_status\", 0, 'ext4', 'mysql');" | sqlite3 /var/lib/wo/dbase.db
|
||||
|
||||
|
||||
wo_php_version="7.2"
|
||||
wo_lib_echo "Updating WordOps Database"
|
||||
echo "ALTER TABLE sites ADD COLUMN db_name varchar;" | sqlite3 /var/lib/wo/dbase.db
|
||||
echo "ALTER TABLE sites ADD COLUMN db_user varchar; " | sqlite3 /var/lib/wo/dbase.db
|
||||
@@ -380,11 +379,7 @@ wo_upgrade_nginx()
|
||||
{
|
||||
|
||||
{
|
||||
# create backup directory
|
||||
mkdir -p /var/lib/wo/backup
|
||||
|
||||
# backup all sites available
|
||||
/usr/bin/rsync -az /etc/nginx/ /var/lib/wo/backup/nginx/
|
||||
|
||||
# chec if the package nginx-ee is installed
|
||||
CHECK_NGINX_EE=$(dpkg --list | grep nginx-ee)
|
||||
@@ -394,28 +389,31 @@ wo_upgrade_nginx()
|
||||
|
||||
# add new Nginx repository
|
||||
if [ "$wo_linux_distro" = "Ubuntu" ]; then
|
||||
echo "deb http://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_${wo_distro_id}/ /" >> /etc/apt/sources.list.d/wo-repo.list
|
||||
wget -qO /tmp/nginx-wo.key "https://download.opensuse.org/repositories/home:virtubox:WordOps/xUbuntu_${wo_distro_id}/Release.key"
|
||||
else
|
||||
if [ "$wo_distro_version" == "jessie" ]; then
|
||||
echo "deb http://download.opensuse.org/repositories/home:/virtubox:/WordOps/Debian_8.0/ /" >> /etc/apt/sources.list.d/wo-repo.list
|
||||
wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_8.0/Release.key
|
||||
else
|
||||
echo "deb http://download.opensuse.org/repositories/home:/virtubox:/WordOps/Debian_9.0/ /" >> /etc/apt/sources.list.d/wo-repo.list
|
||||
wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key
|
||||
fi
|
||||
fi
|
||||
# prevent apt preference to block install
|
||||
[ -f /etc/apt/preferences.d/nginx-block ] && {
|
||||
mv /etc/apt/preferences.d/nginx-block "$HOME/nginx-block"
|
||||
}
|
||||
# import the respository key for updates
|
||||
apt-key add - < /tmp/nginx-wo.key
|
||||
rm -f /tmp/nginx-wo.key
|
||||
sudo apt-get update
|
||||
|
||||
if [ -x /usr/sbin/nginx ] ; then
|
||||
CHECK_BROTLI="$(nginx -V 2>&1 | grep brotli)"
|
||||
if [ -z "$CHECK_BROTLI" ]; then
|
||||
|
||||
# stop nginx
|
||||
service nginx stop
|
||||
|
||||
# prevent apt preference to block install
|
||||
[ -f /etc/apt/preferences.d/nginx-block ] && {
|
||||
mv /etc/apt/preferences.d/nginx-block "$HOME/nginx-block"
|
||||
}
|
||||
|
||||
if [ -n "$CHECK_NGINX_EE" ]; then
|
||||
# remove previous package
|
||||
apt-mark unhold nginx-ee nginx-common nginx-custom
|
||||
@@ -466,8 +464,8 @@ wo_upgrade_nginx()
|
||||
[ -f "$HOME/nginx-block" ] && {
|
||||
mv "$HOME/nginx-block" /etc/apt/preferences.d/nginx-block
|
||||
}
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
} >> /var/log/wo/install.log 2>&1
|
||||
|
||||
}
|
||||
@@ -502,14 +500,17 @@ wo_update_latest()
|
||||
chmod 755 /etc/mysql/conf.d
|
||||
}
|
||||
if [ -f $HOME/.my.cnf ]; then
|
||||
cp ~/.my.cnf /etc/mysql/conf.d/my.cnf &>> /dev/null
|
||||
cp -f $HOME/.my.cnf /etc/mysql/conf.d/my.cnf
|
||||
chmod 600 /etc/mysql/conf.d/my.cnf
|
||||
|
||||
elif [ -f /root/.my.cnf ]; then
|
||||
cp /root/.my.cnf /etc/mysql/conf.d/my.cnf &>> /dev/null
|
||||
cp -f /root/.my.cnf /etc/mysql/conf.d/my.cnf
|
||||
chmod 600 /etc/mysql/conf.d/my.cnf
|
||||
fi
|
||||
else
|
||||
wo_lib_echo_fail ".my.cnf cannot be located in your current user or root folder..."
|
||||
if [ ! -f /root/.my.cnf ]; then
|
||||
cp /etc/mysql/conf.d/my.cnf /root/.my.cnf
|
||||
chmod 600 /root/.my.cnf
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user