From 00971e838929fb314d19e64b3a604cb0ff9adb23 Mon Sep 17 00:00:00 2001 From: Simon Rose <simon.rose@ess.eu> Date: Wed, 14 Apr 2021 15:09:30 +0200 Subject: [PATCH] E3-302: Fixed iocsh.bash --help --- CHANGELOG.md | 5 ++++ configure/E3/RULES_REQUIRE | 2 +- require-ess/tools/iocsh.bash | 2 +- .../{iocsh_functions => iocsh_functions.bash} | 30 ++++++++++++++----- 4 files changed, 30 insertions(+), 9 deletions(-) rename require-ess/tools/{iocsh_functions => iocsh_functions.bash} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cec52fb..07834a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +## Bugfixes +* `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`. + ## [3.4.1] ### Bugfixes diff --git a/configure/E3/RULES_REQUIRE b/configure/E3/RULES_REQUIRE index c1f9f6a6..4832a232 100644 --- a/configure/E3/RULES_REQUIRE +++ b/configure/E3/RULES_REQUIRE @@ -15,7 +15,7 @@ E3_CONFIG_FILE := $(TOP)/tools/e3.cfg E3_TEST_SCRIPT := $(TOP)/tools/test_installed_modules.sh # E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash) -E3_IOC_CFG_FILES := $(E3_MODULE_SRC_PATH)/tools/iocsh_functions +#E3_IOC_CFG_FILES := $(E3_MODULE_SRC_PATH)/tools/iocsh_functions E3_IOC_CFG_FILES += $(E3_ESSENVCFG_FILE) #E3_IOC_CFG_FILES += $(E3_CONFIG_FILE) E3_IOC_CFG_FILES += $(E3_MODULE_SRC_PATH)/tools/setE3Env.bash diff --git a/require-ess/tools/iocsh.bash b/require-ess/tools/iocsh.bash index 59d0c40f..22629f7d 100755 --- a/require-ess/tools/iocsh.bash +++ b/require-ess/tools/iocsh.bash @@ -52,7 +52,7 @@ declare STARTUP="" declare BASECODE="" declare -r TMP_PATH="/tmp/systemd-private-e3-iocsh-$(whoami)" -. ${SC_TOP}/iocsh_functions +. ${SC_TOP}/iocsh_functions.bash # To get the absolute path where iocsh.bash is executed diff --git a/require-ess/tools/iocsh_functions b/require-ess/tools/iocsh_functions.bash similarity index 97% rename from require-ess/tools/iocsh_functions rename to require-ess/tools/iocsh_functions.bash index 1c1ce73e..304c930e 100644 --- a/require-ess/tools/iocsh_functions +++ b/require-ess/tools/iocsh_functions.bash @@ -331,6 +331,7 @@ function check_mandatory_env_settings() { function loadEnv() { local envfile=$IOCSH_TOP/env.sh + local warn=false while [ $# -gt 0 ]; do arg=$1 @@ -338,6 +339,7 @@ function loadEnv() { -e) shift envfile=$1 + warn=true ;; esac shift @@ -346,7 +348,7 @@ function loadEnv() { if [ -f "$envfile" ]; then echo "Loading environment variables from $envfile" source "$envfile" - else + elif [ "$warn" = true ]; then echo "Warning: environment file $envfile does not exist." >&2 fi } @@ -357,12 +359,6 @@ function loadFiles() { file=$1 case $file in - -h | "-?" | -help | --help) - help - ;; - -v | -ver | --ver | -version | --version) - version - ;; -rt | -RT | -realtime | --realtime) REALTIME="RT" __LOADER__="chrt --fifo 1 " @@ -417,6 +413,10 @@ function loadFiles() { -e) shift ;; + -n) + __LOADER__="nice --10 " + shift + ;; -*) printf "Unknown option $1\n\n" >&2 help @@ -494,11 +494,15 @@ function help() { printf "Options:\n\n" printf " -?, -h, --help Show this page and exit.\n" printf " -v, --version Show version and exit.\n" + printf " -e env_file, Load a given environment file 'env_file'.\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 " This forces an 'iocInit' before running the program.\n" printf " -r module[,ver] Modue (optionally with version) loaded via 'require'.\n" + printf " -dg Run with debugger gdb.\n" + printf " -dv Run with valgrind.\n" + printf " @file More arguments are read from file.\n\n" printf "Supported filetypes:\n\n" printf " *.db, *.dbt, *.template loaded via 'dbLoadRecords'\n" @@ -517,3 +521,15 @@ function help() { } >&2 exit } + +for arg in "$@"; do + case $arg in + -h | "-?" | -help | --help) + help + ;; + -v | -ver | --ver | -version | --version) + version + ;; + *) ;; + esac +done \ No newline at end of file -- GitLab