diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d7b03a3422802d025ddf6539a090000873e0e0..0210157cc3ea09ba22b3575d7cc1238e2c9afdf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/require-ess/tools/iocsh b/require-ess/tools/iocsh index 9201e0bbb8f636fbe7a5e22c12a4e5345af51aa2..c14f76e9977310bf03cf75b2c64b80d5f8f52f13 100644 --- a/require-ess/tools/iocsh +++ b/require-ess/tools/iocsh @@ -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 diff --git a/require-ess/tools/iocsh_functions.bash b/require-ess/tools/iocsh_functions.bash index 9c4b12e9ba37f92e273fc69c2380374e7b850594..d1443114a85fd1d8b06126f4c607fe44b9741e3c 100644 --- a/require-ess/tools/iocsh_functions.bash +++ b/require-ess/tools/iocsh_functions.bash @@ -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%-*}"