update nginx_upgrade in install script

This commit is contained in:
VirtuBox
2019-03-22 06:01:02 +01:00
parent a1b2f2d2a6
commit b740e31415

45
install
View File

@@ -222,12 +222,12 @@ wo_sync_db()
if [ "$(echo "$wo_site_current_type" | grep php)" ]; then if [ "$(echo "$wo_site_current_type" | grep php)" ]; then
if [ "$(echo "$wo_site_current_type" | grep php7)" ]; then if [ "$(echo "$wo_site_current_type" | grep php7)" ]; then
php_version="7.0" wo_php_version="7.0"
else else
php_version="5.6" wo_php_version="5.6"
fi fi
else else
php_version="" wo_php_version=""
fi fi
if [ "$(echo "$wo_site_current_type" | grep redis)" ]; then 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 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" 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_name varchar;" | sqlite3 /var/lib/wo/dbase.db
echo "ALTER TABLE sites ADD COLUMN db_user varchar; " | sqlite3 /var/lib/wo/dbase.db echo "ALTER TABLE sites ADD COLUMN db_user varchar; " | sqlite3 /var/lib/wo/dbase.db
@@ -282,8 +281,8 @@ wo_sync_db()
fi fi
# echo "UPDATE sites SET php_version = REPLACE(php_version, '5.6', '7.2');" | sqlite3 /var/lib/wo/dbase.db # echo "UPDATE sites SET php_version = REPLACE(php_version, '5.6', '7.2');" | sqlite3 /var/lib/wo/dbase.db
# echo "UPDATE sites SET php_version = REPLACE(php_version, '7.0', '7.3');" | sqlite3 /var/lib/wo/dbase.db # echo "UPDATE sites SET php_version = REPLACE(php_version, '7.0', '7.3');" | sqlite3 /var/lib/wo/dbase.db
fi fi
} }
@@ -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 # chec if the package nginx-ee is installed
CHECK_NGINX_EE=$(dpkg --list | grep nginx-ee) CHECK_NGINX_EE=$(dpkg --list | grep nginx-ee)
@@ -394,28 +389,31 @@ wo_upgrade_nginx()
# add new Nginx repository # add new Nginx repository
if [ "$wo_linux_distro" = "Ubuntu" ]; then 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" wget -qO /tmp/nginx-wo.key "https://download.opensuse.org/repositories/home:virtubox:WordOps/xUbuntu_${wo_distro_id}/Release.key"
else else
if [ "$wo_distro_version" == "jessie" ]; then 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 wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_8.0/Release.key
else 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 wget -qO /tmp/nginx-wo.key https://download.opensuse.org/repositories/home:virtubox:WordOps/Debian_9.0/Release.key
fi fi
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 # import the respository key for updates
apt-key add - < /tmp/nginx-wo.key apt-key add - < /tmp/nginx-wo.key
rm -f /tmp/nginx-wo.key rm -f /tmp/nginx-wo.key
sudo apt-get update 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 # stop nginx
service nginx stop 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 if [ -n "$CHECK_NGINX_EE" ]; then
# remove previous package # remove previous package
apt-mark unhold nginx-ee nginx-common nginx-custom apt-mark unhold nginx-ee nginx-common nginx-custom
@@ -466,8 +464,8 @@ wo_upgrade_nginx()
[ -f "$HOME/nginx-block" ] && { [ -f "$HOME/nginx-block" ] && {
mv "$HOME/nginx-block" /etc/apt/preferences.d/nginx-block mv "$HOME/nginx-block" /etc/apt/preferences.d/nginx-block
} }
fi
fi
} >> /var/log/wo/install.log 2>&1 } >> /var/log/wo/install.log 2>&1
} }
@@ -502,14 +500,17 @@ wo_update_latest()
chmod 755 /etc/mysql/conf.d chmod 755 /etc/mysql/conf.d
} }
if [ -f $HOME/.my.cnf ]; then 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 chmod 600 /etc/mysql/conf.d/my.cnf
elif [ -f /root/.my.cnf ]; then 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 chmod 600 /etc/mysql/conf.d/my.cnf
fi
else 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
fi fi