Fix wo-update motd
This commit is contained in:
53
install
53
install
@@ -126,31 +126,30 @@ _curl() {
|
|||||||
curl -m 10 --retry 3 -sL "$@"
|
curl -m 10 --retry 3 -sL "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
###
|
wo_init_variables() {
|
||||||
# 1 - Define variables for later use
|
if [ -z "$wo_branch" ]; then
|
||||||
###
|
if [ "$wo_travis" = "y" ]; then
|
||||||
if [ -z "$wo_branch" ]; then
|
wo_branch=updating-configuration
|
||||||
if [ "$wo_travis" = "y" ]; then
|
else
|
||||||
wo_branch=updating-configuration
|
wo_branch=master
|
||||||
else
|
fi
|
||||||
wo_branch=master
|
|
||||||
fi
|
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
|
readonly wo_tmp_dir=/var/lib/wo/tmp
|
||||||
readonly wo_tmp_dir=/var/lib/wo/tmp
|
readonly wo_install_log=/var/log/wo/install.log
|
||||||
readonly wo_install_log=/var/log/wo/install.log
|
readonly TIME_FORMAT='%d-%b-%Y-%H%M%S'
|
||||||
readonly TIME_FORMAT='%d-%b-%Y-%H%M%S'
|
readonly TIME=$(date +"$TIME_FORMAT")
|
||||||
readonly TIME=$(date +"$TIME_FORMAT")
|
readonly NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.gz"
|
||||||
readonly NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.gz"
|
readonly EE_BACKUP_FILE="/var/lib/wo-backup/ee-backup.$TIME.tar.gz"
|
||||||
readonly EE_BACKUP_FILE="/var/lib/wo-backup/ee-backup.$TIME.tar.gz"
|
readonly WO_BACKUP_FILE="/var/lib/wo-backup/wo-backup.$TIME.tar.gz"
|
||||||
readonly WO_BACKUP_FILE="/var/lib/wo-backup/wo-backup.$TIME.tar.gz"
|
|
||||||
|
|
||||||
if [ -x /usr/local/bin/ee ]; then
|
if [ -x /usr/local/bin/ee ]; then
|
||||||
ee_migration=1
|
ee_migration=1
|
||||||
elif [ -x /usr/local/bin/wo ]; then
|
elif [ -x /usr/local/bin/wo ]; then
|
||||||
wo_upgrade=1
|
wo_upgrade=1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
# 1 - Checking linux distro
|
# 1 - Checking linux distro
|
||||||
@@ -670,6 +669,10 @@ wo_init() {
|
|||||||
# 4 - WO MAIN SETUP
|
# 4 - WO MAIN SETUP
|
||||||
###
|
###
|
||||||
|
|
||||||
|
###
|
||||||
|
# 1 - Define variables for later use
|
||||||
|
###
|
||||||
|
|
||||||
# wo uninstall script
|
# wo uninstall script
|
||||||
if [ "$wo_purge" = "y" ]; then
|
if [ "$wo_purge" = "y" ]; then
|
||||||
_run wo_backup_wo "Backing-up WO install"
|
_run wo_backup_wo "Backing-up WO install"
|
||||||
@@ -677,9 +680,11 @@ if [ "$wo_purge" = "y" ]; then
|
|||||||
wo_lib_echo "The WordOps backup files can be found in $WO_BACKUP_FILE"
|
wo_lib_echo "The WordOps backup files can be found in $WO_BACKUP_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
# inital checkup
|
||||||
wo_dir_init
|
wo_dir_init
|
||||||
_run wo_clean_repo
|
|
||||||
wo_init
|
wo_init
|
||||||
|
wo_init_variables
|
||||||
|
_run wo_clean_repo
|
||||||
wo_check_distro
|
wo_check_distro
|
||||||
# 1 - WO already installed
|
# 1 - WO already installed
|
||||||
if [ -x /usr/local/bin/wo ]; then
|
if [ -x /usr/local/bin/wo ]; then
|
||||||
|
|||||||
@@ -1470,10 +1470,15 @@ def pre_stack(self):
|
|||||||
'root soft nofile 500000\n')
|
'root soft nofile 500000\n')
|
||||||
# custom motd-news
|
# custom motd-news
|
||||||
data = dict()
|
data = dict()
|
||||||
|
# check if update-motd.d directory exist
|
||||||
if os.path.isdir('/etc/update-motd.d/'):
|
if os.path.isdir('/etc/update-motd.d/'):
|
||||||
if not os.path.isfile('/etc/update-motd.d/98-wo-update'):
|
if not os.path.isfile('/etc/update-motd.d/98-wo-update'):
|
||||||
|
# render custom motd template
|
||||||
WOTemplate.deploy(
|
WOTemplate.deploy(
|
||||||
self, '/etc/update-motd.d/98-wo-update',
|
self, '/etc/update-motd.d/98-wo-update',
|
||||||
'wo-update.mustache', data)
|
'wo-update.mustache', data)
|
||||||
WOFileUtils.chmod(
|
WOFileUtils.chmod(
|
||||||
self, "/etc/update-motd.d/98-wo-update", 0o755)
|
self, "/etc/update-motd.d/98-wo-update", 0o755)
|
||||||
|
# restart motd-news service if available
|
||||||
|
if os.path.isfile('/lib/systemd/system/motd-news.service'):
|
||||||
|
WOService.restart_service(self, 'motd-news')
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ ERR=$(mktemp) || exit 1
|
|||||||
CLOUD=$(mktemp) || exit 1
|
CLOUD=$(mktemp) || exit 1
|
||||||
trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP BUS TERM
|
trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP BUS TERM
|
||||||
|
|
||||||
if [ -n "$(command -v curl > /dev/null 2>&1)" ]; then
|
if [ -n "$(command -v curl)" ]; then
|
||||||
LATEST_RELEASE=$(curl -m 5 --retry 3 -sI "$URL" | grep tag | awk -F "/" '{print $8}' 2>&1)
|
LATEST_RELEASE=$(curl -m 5 --retry 3 -sI "$URL" | grep tag | awk -F "/" '{print $8}' 2>&1)
|
||||||
fi
|
fi
|
||||||
if [ -n "$(command -v wo > /dev/null 2>&1)" ]; then
|
if [ -n "$(command -v wo)" ]; then
|
||||||
CURRENT_RELEASE=$(wo -v 2>&1 | grep v | awk -F " " '{print $2}')
|
CURRENT_RELEASE=$(wo -v 2>&1 | grep v | awk -F " " '{print $2}')
|
||||||
fi
|
fi
|
||||||
if [ -n "$CURRENT_RELEASE" ] && [ -n "$LATEST_RELEASE" ]; then
|
if [ -n "$CURRENT_RELEASE" ] && [ -n "$LATEST_RELEASE" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user