Skip to content
Snippets Groups Projects
Commit 65cbe6b5 authored by kpetersn's avatar kpetersn
Browse files

Added newPrefix.sh and made a few minor changes so the IOC can use a different...

Added newPrefix.sh and made a few minor changes so the IOC can use a different prefix without running changePrefix
parent fad8b50b
Branches master
Tags 2.1 2.2 2.3 2.4 2.5 2023-03-20 start
No related merge requests found
......@@ -18,3 +18,5 @@ built_*.req
dbl-all.txt
*.sav*
scan1Menu.sav
override.*
my-xxx.*
......@@ -12,6 +12,7 @@ dbLoadDatabase("../../dbd/iocxxxLinux.dbd")
iocxxxLinux_registerRecordDeviceDriver(pdbbase)
< settings.iocsh
< override.iocsh
< common.iocsh
#- devIocStats
......
#!/bin/bash
#
# Customize the IOC's prefix without renaming any files in xxx
#
# Generate a random IOC name
RANDOM_IOC_NAME=`cat /dev/urandom | tr -dc '[:lower:]' | fold -w 3 | head -n 1`
# Use a random IOC name if the user doesn't specify one and use yyy if a random name can't be generated
NEW_IOC_NAME=${1:-${RANDOM_IOC_NAME:-yyy}}
NEW_IOC_PREFIX="${NEW_IOC_NAME}:"
# Tell the user the new name
echo "New IOC name = ${NEW_IOC_NAME}"
echo "New IOC prefix = ${NEW_IOC_PREFIX}"
# Rename existing custom screens if they exist
if [ -f "xxxApp/op/ui/my-xxx.ui" ]
then
#!echo "Renaming existing custom caQtDM screen"
mv -f xxxApp/op/ui/my-xxx.ui xxxApp/op/ui/my-xxx.ui.last
fi
if [ -f "xxxApp/op/adl/my-xxx.adl" ]
then
#!echo "Renaming existing custom MEDM screen"
mv -f xxxApp/op/adl/my-xxx.adl xxxApp/op/adl/my-xxx.adl.last
fi
# Create new custom screens
echo "Creating a custom caQtDM screen for ${NEW_IOC_NAME}"
sed -e "s/xxx/${NEW_IOC_NAME}/g" xxxApp/op/ui/xxx.ui > xxxApp/op/ui/my-xxx.ui
echo "Creating a custom MEDM screen for ${NEW_IOC_NAME}"
sed -e "s/xxx/${NEW_IOC_NAME}/g" xxxApp/op/adl/xxx.adl > xxxApp/op/adl/my-xxx.adl
# Renaming existing overrides file if it exists
if [ -f "iocBoot/iocxxx/override.iocsh" ]
then
#!echo "Renaming existing override.iocsh file"
mv -f iocBoot/iocxxx/override.iocsh iocBoot/iocxxx/override.iocsh.last
fi
# Create an overrides file to override environment variables that would usually be customized in place
echo "Creating override.iocsh to override the IOC prefix"
echo "epicsEnvSet(\"PREFIX\", \"${NEW_IOC_PREFIX}\")" > iocBoot/iocxxx/override.iocsh
echo "epicsEnvSet(\"IOCSH_PS1\", \"${NEW_IOC_NAME}> \")" >> iocBoot/iocxxx/override.iocsh
echo "epicsEnvSet(\"LOCATION\", \"Virtual\")" >> iocBoot/iocxxx/override.iocsh
echo "epicsEnvSet(\"GROUP\", \"Training\")" >> iocBoot/iocxxx/override.iocsh
......@@ -2,7 +2,7 @@
export EPICS_APP=`dirname ${BASH_SOURCE:-$0}`
export EPICS_APP_ADL_DIR=${EPICS_APP}/xxxApp/op/adl
export DEFAULT_UI_FILE=${1:-${DEFAULT_UI_FILE:-xxx.ui}}
export DEFAULT_UI_FILE=${1:-${DEFAULT_UI_FILE:-my-xxx.adl}}
export UI_FILE_MACROS=${2:-"P=xxx:"}
source ${EPICS_APP}/setup_epics_common medm
......
......@@ -2,7 +2,7 @@
export EPICS_APP=`dirname ${BASH_SOURCE:-$0}`
export EPICS_APP_UI_DIR=${EPICS_APP}/xxxApp/op/ui
export DEFAULT_UI_FILE=${1:-${DEFAULT_UI_FILE:-xxx.ui}}
export DEFAULT_UI_FILE=${1:-${DEFAULT_UI_FILE:-my-xxx.ui}}
export UI_FILE_MACROS=${2:-"P=xxx:"}
source ${EPICS_APP}/setup_epics_common caqtdm
......
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