Skip to content
Snippets Groups Projects
Commit 72846adc authored by Simon Rose's avatar Simon Rose
Browse files

E3-662: Improved IOC startup output

parent 8d43c6b5
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Patch system now applies all patches in the `patch/` directory. Versioning for patches should be handled by git,
not by require.
* The loop over `EPICSVERSION` in `driver.makefile` has been removed; various other cleanup has been performed.
* Improved output during IOC startup
## [4.0.0]
......
......@@ -105,19 +105,23 @@ IOC_STARTUP=$(mktemp -p "${TMP_PATH}" -q --suffix=_iocsh_${SC_VERSION}) || die 1
# EPICS_DRIVER_PATH defined in iocsh and startup.script_common
# Remember, driver is equal to module, so EPICS_DRIVER_PATH is the module directory
# In our jargon. It is the same as ${EPICS_MODULES}
print_iocsh_header
# shellcheck disable=SC2064
trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
{
printIocEnv
printf "# Set REQUIRE_IOC for its internal PVs\n"
print_header_line "IOC startup commands"
printf "# // Set REQUIRE_IOC for its internal PVs\n"
printf "epicsEnvSet REQUIRE_IOC \"%s\"\n" "${REQUIRE_IOC}"
printf "#\n"
printf "# Enable an exit subroutine for sotfioc\n"
printf "# // Enable an exit subroutine for sotfioc\n"
printf "dbLoadRecords \"%s/db/softIocExit.db\" \"IOC=%s\"\n" "${EPICS_BASE}" "${REQUIRE_IOC}"
printf "#\n"
printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "# // Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "epicsEnvSet E3_IOCSH_TOP \"%s\"\n" "${IOCSH_TOP}"
printf "#\n"
......@@ -125,7 +129,7 @@ trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
loadFiles "$@"
printf "# Set the IOC Prompt String One \n"
printf "# // Set the IOC Prompt String\n"
printf "epicsEnvSet IOCSH_PS1 \"%s\"\n" "$IOCSH_PS1"
printf "#\n"
......@@ -134,7 +138,6 @@ trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
fi
if [ "$init" != NO ]; then
printf "# \n"
printf "iocInit\n"
fi
......
......@@ -90,71 +90,43 @@ function version() {
exit
}
# This function doesn't work
function printParamShow() {
declare -a var_list=()
var_list+=(EPICS_CA_REPEATER_PORT)
var_list+=(EPICS_CA_SERVER_PORT)
var_list+=(EPICS_TIMEZONE)
var_list+=(EPICS_TS_NTP_INET)
var_list+=(EPICS_AR_PORT)
var_list+=(EPICS_VERSION_MAJOR)
var_list+=(EPICS_VERSION_MIDDLE)
var_list+=(EPICS_VERSION_MINOR)
var_list+=(EPICS_VERSION_PATCH)
var_list+=(EPICS_VERSION_FULL)
function print_iocsh_header() {
for var in "${var_list[@]}"; do
printf "# %s=\"%s\"\n" "$var" "${!var}"
printf "███████╗██████╗ ██╗ ██████╗ ██████╗ ███████╗██╗ ██╗███████╗██╗ ██╗ \n"
printf "██╔════╝╚════██╗ ██║██╔═══██╗██╔════╝ ██╔════╝██║ ██║██╔════╝██║ ██║ \n"
printf "█████╗ █████╔╝ ██║██║ ██║██║ ███████╗███████║█████╗ ██║ ██║ \n"
printf "██╔══╝ ╚═══██╗ ██║██║ ██║██║ ╚════██║██╔══██║██╔══╝ ██║ ██║ \n"
printf "███████╗██████╔╝ ██║╚██████╔╝╚██████╗ ███████║██║ ██║███████╗███████╗███████╗\n"
printf "╚══════╝╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝\n"
printf "\n"
}
function print_header_line() {
printf "############################################################################\n"
printf "## %s\n" "${1}"
printf "############################################################################\n"
}
function print_vars() {
print_header_line "$1"
shift
for var in "$@"; do
printf "# %s = \"%s\"\n" "${var}" "${!var}"
done
printf "#\n"
}
function printIocEnv() {
declare -a var_list=()
var_list+=(HOSTDISPLAY)
var_list+=(WINDOWID)
var_list+=(PWD)
var_list+=(USER)
var_list+=(LOGNAME)
var_list+=(EPICS_HOST_ARCH)
var_list+=(EPICS_BASE)
# REQUIRE
var_list+=(E3_REQUIRE_NAME)
var_list+=(E3_REQUIRE_VERSION)
var_list+=(E3_REQUIRE_LOCATION)
var_list+=(E3_REQUIRE_BIN)
var_list+=(E3_REQUIRE_DB)
var_list+=(E3_REQUIRE_DBD)
var_list+=(E3_REQUIRE_INC)
var_list+=(E3_REQUIRE_LIB)
# EPICS and others
var_list+=(EPICS_DRIVER_PATH)
var_list+=(EPICS_CA_AUTO_ADDR_LIST)
var_list+=(EPICS_CA_ADDR_LIST)
var_list+=(EPICS_PVA_AUTO_ADDR_LIST)
var_list+=(EPICS_PVA_ADDR_LIST)
var_list+=(PATH)
printf "#\n"
printf "# Start at \"%s\"\n" "$(date +%Y-W%V-%b%d-%H%M-%S-%Z)"
printf "#\n"
printf "# Version information:\n"
printf "# %s : %s%s\n" "European Spallation Source ERIC" "$SC_SCRIPTNAME" ${SC_VERSION:+" ($SC_VERSION)"}
printf "#\n"
printf "# --->--> snip -->--> \n"
printf "# Please Use Version and other environment variables\n"
printf "# in order to report or debug this shell\n"
printf "#\n"
for var in "${var_list[@]}"; do
printf "# %s=\"%s\"\n" "$var" "${!var}"
done
printf "# --->--> snip -->--> \n"
printf "#\n"
print_vars "Shell and environment variables" PWD USER LOGNAME PATH
print_vars "EPICS variables" EPICS_BASE EPICS_HOST_ARCH EPICS_DRIVER_PATH EPICS_CA_AUTO_ADDR_LIST EPICS_CA_ADDR_LIST EPICS_PVA_AUTO_ADDR_LIST EPICS_PVA_ADDR_LIST
print_vars "e3-specific variables" E3_REQUIRE_VERSION E3_REQUIRE_LOCATION E3_REQUIRE_BIN E3_REQUIRE_DB E3_REQUIRE_DBD E3_REQUIRE_INC E3_REQUIRE_LIB
}
# Ctrl+c : OK
......@@ -244,9 +216,8 @@ function loadRequire() {
local require_lib=${E3_REQUIRE_LIB}/${EPICS_HOST_ARCH}/${libName}
local require_dbd=${E3_REQUIRE_DBD}/${E3_REQUIRE_NAME}.dbd
printf "# \n"
printf "# Load %s module, which has the version %s\n" "${E3_REQUIRE_NAME}" "${E3_REQUIRE_VERSION}"
printf "# \n"
printf "# // Load %s module, version %s\n" "${E3_REQUIRE_NAME}" "${E3_REQUIRE_VERSION}"
printf "#\n"
printf "dlload %s\n" "${require_lib}"
printf "dbLoadDatabase %s\n" "${require_dbd}"
printf "%s_registerRecordDeviceDriver\n\n" "${E3_REQUIRE_NAME%-*}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment