Package log_functions.sh into platform-util

The log_functions.sh script file was dropped in a
recent edit of the compute-huge rpm.

Some scripts depend on this file for log utilities.

This update moves log_functions.sh out of compute-huge
into platform-util and re-installs it in its previous
location /etc/init.d

Story: 2004043
Task: 28462
Change-Id: I4efb0a63f29bc446e7efd86cea7488f3e2e362df
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2018-12-10 19:02:18 -05:00
parent f60e67741e
commit 11a4f7a696
3 changed files with 51 additions and 1 deletions

View File

@ -1,4 +1,4 @@
SRC_DIR="platform-util"
COPY_LIST_TO_TAR="scripts"
TIS_PATCH_VER=14
TIS_PATCH_VER=15

View File

@ -28,6 +28,7 @@ Platform utilities that don't get packaged on controller hosts
%define local_bindir %{local_dir}/bin
%define local_sbindir %{local_dir}/sbin
%define pythonroot /usr/lib64/python2.7/site-packages
%define local_etc_initd %{_sysconfdir}/init.d
%prep
%setup
@ -53,6 +54,9 @@ install %{_buildsubdir}/scripts/cgcs_tc_setup.sh %{buildroot}%{local_bindir}
install %{_buildsubdir}/scripts/remotelogging_tc_setup.sh %{buildroot}%{local_bindir}
install %{_buildsubdir}/scripts/connectivity_test %{buildroot}%{local_bindir}
install -d %{buildroot}%{local_etc_initd}
install %{_buildsubdir}/scripts/log_functions.sh %{buildroot}%{local_etc_initd}
install -d %{buildroot}%{local_sbindir}
install -m 700 -P -D %{_buildsubdir}/scripts/patch-restart-mtce %{buildroot}%{local_sbindir}
install -m 700 -p -D %{_buildsubdir}/scripts/patch-restart-processes %{buildroot}%{local_sbindir}
@ -87,6 +91,7 @@ systemctl enable opt-platform.service
%{pythonroot}/platform_util/*
%dir %{pythonroot}/platform_util-%{version}.0-py2.7.egg-info
%{pythonroot}/platform_util-%{version}.0-py2.7.egg-info/*
%{local_etc_initd}/log_functions.sh
%files -n platform-util-noncontroller
%defattr(-,root,root,-)

View File

@ -0,0 +1,45 @@
#!/bin/bash
################################################################################
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
################################################################################
# Log if debug is enabled via LOG_DEBUG
#
################################################################################
function log_debug {
if [ ! -z "${LOG_DEBUG}" ]; then
logger -p debug -t "$0[${PPID}]" -s "$@" 2>&1
fi
}
################################################################################
# Log unconditionally to STDERR
#
################################################################################
function log_error {
logger -p error -t "$0[${PPID}]" -s "$@"
}
################################################################################
# Log unconditionally to STDOUT
#
################################################################################
function log {
logger -p info -t "$0[${PPID}]" -s "$@" 2>&1
}
################################################################################
# Utility function to print the status of a command result
#
################################################################################
function print_status {
if [ "$1" -eq "0" ]; then
echo "[ OK ]"
else
echo "[FAILED]"
fi
}