Fix wo-update motd
This commit is contained in:
@@ -1470,10 +1470,15 @@ def pre_stack(self):
|
||||
'root soft nofile 500000\n')
|
||||
# custom motd-news
|
||||
data = dict()
|
||||
# check if update-motd.d directory exist
|
||||
if os.path.isdir('/etc/update-motd.d/'):
|
||||
if not os.path.isfile('/etc/update-motd.d/98-wo-update'):
|
||||
# render custom motd template
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/update-motd.d/98-wo-update',
|
||||
'wo-update.mustache', data)
|
||||
WOFileUtils.chmod(
|
||||
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
|
||||
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)
|
||||
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}')
|
||||
fi
|
||||
if [ -n "$CURRENT_RELEASE" ] && [ -n "$LATEST_RELEASE" ]; then
|
||||
|
||||
Reference in New Issue
Block a user