diff --git a/tools/iocsh.bash b/tools/iocsh.bash index d5566fd595607ffd925f85f40d88aba02b308e41..ff3506ac89438ee1465ee657a9bd893997e6aad1 100755 --- a/tools/iocsh.bash +++ b/tools/iocsh.bash @@ -44,11 +44,12 @@ # term if each IOC cannot be closed properly # 0.4.3 : - Tune REQUIRE-* PV in order to replace - with . easily # 0.4.4 : - Replace the absolute bash path with env one +# 0.5.0 : - Introduce EPICSV3 to use softIoc instead of softIocPVA after BASE 7.0.3.1 # declare -gr SC_SCRIPT="$(realpath "$0")"; declare -gr SC_SCRIPTNAME=${0##*/}; declare -gr SC_TOP="${SC_SCRIPT%/*}"; -declare -g SC_VERSION="0.4.4"; +declare -g SC_VERSION="0.5.0"; declare -g STARTUP=""; declare -g BASECODE=""; declare -gr TMP_PATH="/tmp/systemd-private-e3-iocsh"; @@ -106,12 +107,11 @@ trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM printf "# Set REQUIRE_IOC for its internal PVs\n"; printf "epicsEnvSet REQUIRE_IOC \"${REQUIRE_IOC}\"\n"; printf "#\n"; - printf "# Enable an exit subroutine for sotfioc\n"; + printf "# Enable an exit subroutine.\n" printf "dbLoadRecords \"${EPICS_BASE}/db/softIocExit.db\" \"IOC=${REQUIRE_IOC}\"\n"; printf "#\n"; printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}" printf "epicsEnvSet E3_IOCSH_TOP \"${IOCSH_TOP}\"\n"; - printf "#\n"; loadRequire; @@ -124,7 +124,7 @@ trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM if [ "$REALTIME" == "RT" ]; then printf "# Real Time \"$REALTIME\"\n"; fi - + if [ "$init" != NO ]; then printf "# \n"; printf "iocInit\n" @@ -147,13 +147,23 @@ else __CHRT__=""; fi + if [[ ${BASECODE} -ge 07000101 ]]; then - __PVA__="PVA" + if [ "$EPICSV3" == "V3" ]; then + SOFTIOC_NAME="softIoc" + else + SOFTIOC_NAME="softIocPVA" + fi else - __PVA__="" + SOFTIOC_NAME="softIoc" fi -# -# -${__CHRT__}${EPICS_BASE}/bin/${EPICS_HOST_ARCH}/softIoc${__PVA__} -D ${EPICS_BASE}/dbd/softIoc${__PVA__}.dbd "${IOC_STARTUP}" 2>&1 +if [[ ${BASECODE} -eq 07000301 ]] && [ "$EPICSV3" == "V3" ]; then + SOFTIOC_NAME="softIocPVA" + printf "## \n"; + printf "## Unfornately, EPICS_BASE %s doesn't support the softIoc feature.\n" "${EPICS_BASE}"; + printf "## Force to use %s \n" "${SOFTIOC_NAME}"; + printf "## \n"; +fi +${__CHRT__}${EPICS_BASE}/bin/${EPICS_HOST_ARCH}/${SOFTIOC_NAME} -D ${EPICS_BASE}/dbd/${SOFTIOC_NAME}.dbd "${IOC_STARTUP}" 2>&1 diff --git a/tools/iocsh_functions b/tools/iocsh_functions index df3636063d55aa3019e2f92e7e7d8d8dce11777f..f6694ff8200c8d79252240965ef2d50d357a3d63 100644 --- a/tools/iocsh_functions +++ b/tools/iocsh_functions @@ -29,6 +29,8 @@ E_NOTROOT=101 EXIST=1 NON_EXIST=0 REALTIME= +EPICSV3= +SOFTIOC_NAME= function pushd { builtin pushd "$@" > /dev/null; } function popd { builtin popd "$@" > /dev/null; } @@ -223,21 +225,24 @@ function printIocEnv var_list+=(PATH); var_list+=(LD_LIBRARY_PATH); + printf "#\n"; - printf "# Start at \"$(date +%Y-W%V-%b%d-%H%M-%S-%Z)\"\n" - printf "#\n"; - printf "# Version information:\n"; - printf "# %s : %s%s\n" "European Spallation Source ERIC" "$SC_SCRIPTNAME" ${SC_VERSION:+" ($SC_VERSION)"}; + + printf "# ------>-----> snip ----->------> \n"; 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"; + printf "# The IOC is started at \"$(date +%Y-W%V-%b%d-%H%M-%S-%Z)\"\n"; + printf "#\n"; + printf "# Version information:\n"; + printf "# %s : %s%s\n" "European Spallation Source ERIC" "$SC_SCRIPTNAME" ${SC_VERSION:+" ($SC_VERSION)"}; + printf "#\n"; for var in ${var_list[@]}; do printf "# $var=\"${!var}\"\n" done - printf "# --->--> snip -->--> \n"; + printf "#\n"; + printf "# ------>-----> snip ----->------> \n"; printf "#\n"; }; @@ -393,6 +398,9 @@ function loadFiles ( -rt | -RT | -realtime | --realtime ) REALTIME="RT" ;; + ( -v3 | -V3 | -epicsv3 | --EPICSV3 ) + EPICSV3="V3" + ;; ( @* ) loadFiles $(cat ${file#@}) ;;