Skip to content
Snippets Groups Projects
Commit 62d06f02 authored by Wayne Lewis's avatar Wayne Lewis
Browse files

Merge branch 'e3-547-update_iocinit_in_iocsh_bash' into 'master'

Fix handling of iocInit in iocsh.bash

See merge request e3/e3-require!49
parents 31c72913 a499ec21
No related branches found
No related tags found
1 merge request!49Fix handling of iocInit in iocsh.bash
Pipeline #97873 passed
...@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* * Tests that elementary patching/building works as expected * * Tests that elementary patching/building works as expected
* Added consistency check between e3 environment variables and path to `iocsh.bash`. `iocsh.bash` will abort if these are not consistent. * Added consistency check between e3 environment variables and path to `iocsh.bash`. `iocsh.bash` will abort if these are not consistent.
* Add e3 version infomation to the shell prompt * Add e3 version infomation to the shell prompt
* Add option to allow override of automatic addition of `iocInit` to generated startup script
### Bugfixes ### Bugfixes
* `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`. * `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`.
...@@ -28,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -28,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Other changes ### Other changes
* removed legacy code from setE3Env.bash * removed legacy code from setE3Env.bash
* Removed usage of `env.sh` - now there is a check only for seeing if the environment variable `$IOCNAME` is set * Removed usage of `env.sh` - now there is a check only for seeing if the environment variable `$IOCNAME` is set
* Fix typos in `iocsh_functions.bash` comments
* Rearrange usage to match order of options in code
* Add information about realtime option to usage
## [3.4.1] ## [3.4.1]
......
...@@ -45,7 +45,7 @@ function read_file_get_string { ...@@ -45,7 +45,7 @@ function read_file_get_string {
# First Two : 00 (EPICS VERSION) # First Two : 00 (EPICS VERSION)
# Second Two : 00 (EPICS_REVISION) # Second Two : 00 (EPICS_REVISION)
# Third Two : 00 (EPICS_MODIFICATION) # Third Two : 00 (EPICS_MODIFICATION)
# Fouth Two : 00 (EPICS_PATCH_LEVEL) # Fourth Two : 00 (EPICS_PATCH_LEVEL)
function basecode_generator() { #@ Generator BASECODE function basecode_generator() { #@ Generator BASECODE
#@ USAGE: BASECODE=$(basecode_generator) #@ USAGE: BASECODE=$(basecode_generator)
...@@ -160,8 +160,8 @@ function printIocEnv() { ...@@ -160,8 +160,8 @@ function printIocEnv() {
# Ctrl+c : OK # Ctrl+c : OK
# exit : OK # exit : OK
# kill softioc process : OK # kill softioc process : OK
# kill main precess : Enter twice in terminal, # kill main process : Enter twice in terminal,
# close softIoc, but STATUP file is remained. # close softIoc, but STARTUP file is remained.
# #
function softIoc_end() { function softIoc_end() {
...@@ -316,6 +316,9 @@ function loadFiles() { ...@@ -316,6 +316,9 @@ function loadFiles() {
fi fi
echo "seq $1" echo "seq $1"
;; ;;
-i | -noinit | --noinit)
init=NO
;;
-r) -r)
shift shift
echo "require $1" echo "require $1"
...@@ -375,7 +378,11 @@ function loadFiles() { ...@@ -375,7 +378,11 @@ function loadFiles() {
set_e3_cmd_top "$file" set_e3_cmd_top "$file"
echo "iocshLoad '$file','$subst'" echo "iocshLoad '$file','$subst'"
if grep -q iocInit "$file"; then # Search for any instance of iocInit at the start of the line.
# If found, do not add the iocInit to the startup script. Any
# other occurrence of iocInit (e.g. in comments) is not matched
# and the script will add an active iocInit.
if grep -q "^\s*iocInit\b" "$file"; then
init=NO init=NO
fi fi
;; ;;
...@@ -415,11 +422,16 @@ function help() { ...@@ -415,11 +422,16 @@ function help() {
printf "Options:\n\n" printf "Options:\n\n"
printf " -?, -h, --help Show this page and exit.\n" printf " -?, -h, --help Show this page and exit.\n"
printf " -v, --version Show version and exit.\n" printf " -v, --version Show version and exit.\n"
printf " -rt Execute in realtime mode.\n"
printf " (Also -RT, -realtime, --realtime)\n"
printf " -c 'cmd args' Ioc shell command.\n" printf " -c 'cmd args' Ioc shell command.\n"
printf " -l 'cell path' Run Ioc with a cell path.\n"
printf " -s 'prog m=v' Sequencer program (and arguments), run with 'seq'.\n" printf " -s 'prog m=v' Sequencer program (and arguments), run with 'seq'.\n"
printf " This forces an 'iocInit' before running the program.\n" printf " This forces an 'iocInit' before running the program.\n"
printf " -r module[,ver] Modue (optionally with version) loaded via 'require'.\n" printf " -i Do not add iocInit. This option does not override\n"
printf " a valid iocInit in the startup script.\n"
printf " (Also -noinit, --noinit)"
printf " -r module[,ver] Module (optionally with version) loaded via 'require'.\n"
printf " -l 'cell path' Run Ioc with a cell path.\n"
printf " -dg Run with debugger gdb.\n" printf " -dg Run with debugger gdb.\n"
printf " -dv Run with valgrind.\n" printf " -dv Run with valgrind.\n"
printf " -n Run with 'nice --10' (requires sudo).\n" printf " -n Run with 'nice --10' (requires sudo).\n"
...@@ -436,7 +448,8 @@ function help() { ...@@ -436,7 +448,8 @@ function help() {
printf " iocsh.bash st.cmd\n" printf " iocsh.bash st.cmd\n"
printf " iocsh.bash my_database.template P=XY M=3\n" printf " iocsh.bash my_database.template P=XY M=3\n"
printf " iocsh.bash -r my_module,version -c 'initModule()'\n" printf " iocsh.bash -r my_module,version -c 'initModule()'\n"
printf " iocsh.bash -c 'var requireDebug 1' st.cmd\n\n" printf " iocsh.bash -c 'var requireDebug 1' st.cmd\n"
printf " iocsh.bash -i st.cmd\n\n"
} >&2 } >&2
exit exit
......
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