Acknowledgement
This script is a modified version of Mark Rivers’s makeADPrebuilt script, which can be found at https://github.com/areaDetector/areaDetector/blob/master/makeADPrebuilt.
Requirements
- ADSupport, ADCore, and any detectors to be copied must be compiled already.
- The EPICS modules that these plugins depend on must be compiled already.
- asyn, autosave, busy, calc, seq, sscan, (dev)iocStats
- EPICS base must be compiled already
Usage
Before Running
Before using the script, it is necessary to define the following macros in deploy.sh which define the locations of the crucial files.
Macro | Value | Example |
---|---|---|
AREA_DETECTOR | The name of the folder containing all AreaDetector repositories. | areaDetector |
ASYN | The name of the local EPICS asyn repository. | asyn-4-33 |
AUTOSAVE | The name of the local EPICS autosave repository. | autosave-5-9 |
BUSY | The name of the local EPICS busy repository. | busy-1-7 |
CALC | The name of the local EPICS calc repository. | calc-3-7 |
DEVIOCSTATS | The name of the local EPICS devIocStats OR iocStats repository. | iocStats-3-1-15 |
SEQ | The name of the local EPICS seq repository. | seq-2-2-5 |
BASE_TOP | The path to the folder containing the local EPICS base installation. | /controls/devel |
BASE | The name of the local EPICS base installation. | base-7-0-1-1 |
SUPPORT | The path to the folder containing $AREA_DETECTOR, $ASYN, $AUTOSAVE, etc. | /controls/devel/support |
These should be defined in such a way that the absolute path to the locally cloned (and compiled) EPICS base repository would be $BASE_TOP/$BASE, asyn would be $SUPPORT/$ASYN, areaDetector would be $SUPPORT/$AREA_DETECTOR, ADProsilica would be $SUPPORT/$AREA_DETECTOR/ADProsilica, etc.
Additionally, there are some optional variables that you can define:
Variable | Value | Example |
---|---|---|
DESTINATION | The path to the folder that will contain the resulting tarball. | /controls/prod/Deb7/master |
NAME | The name of the tarball. | ${arg1}_${arg2}_Prebuilt_${arg3}_$DATE |
det | A list of AD plugin/driver names that will all be deployed when run with the -a flag. | “ADProsilica”, “ADEiger”, “ADAndor3” |
$DESTINATION will be created if it does not exist.
By default, the tarball will be deployed in a folder “DEPLOYMENTS” in the folder that the script was called from. For example,
bash /ioc_deploy/deploy.sh ADProsilica R2-2 linux_x86-64
would create
./DEPLOYMENTS/ADProsilica_R2-2_Prebuilt_linux-x86_64_2018-08-03.tgz
Running the Script
The script takes three arguments: (1) The areaDetector driver to deploy, (2) the version of the driver, and (3) the EPICS_HOST_ARCH architecture. The script will ask for additional drivers to add, if you want to deploy multiple drivers in one tarball; to bypass this prompt, use the -f flag prior to the arguments. Examples:
bash deploy.sh ADProsilica R2-2 linux_x86-64
bash deploy.sh -f aravisGigE R1-0 linux-x86_64
To deploy multiple drivers at once, define the array “det” in deploy.sh to include the names of all drivers you want to add and run the script with the -a flag.
- Note: The first two command line arguments are arbitrary when deploying this way, and there is no prompt to add additional drivers.
bash deploy.sh -a NSLS2 master linux_x86-64
After Deployment
After deployment, a tarball and a README_$NAME.txt file will be found in the folder pointed to by $DESTINATION as defined in deploy.sh. The README_$NAME.txt provides information on the version of each component used in the deployment, obtained via git tags.
- Note: This only works for components which come from git repositories, and for those that are not git repositories but are within git repositories (such as seq in synApps) it may give misleading info from their parent folder. It is suggested to put the version in the name of the folder for these components (eg. seq-2-2-5).
When the tarball is unpacked, it will contain all the key files needed for an IOC deployment, a copy of the README file, a bash script standardizeIOC.sh, a scripts folder, and a prebuilts folder. The scripts folder contains components scripts for standardizeIOC, and the prebuilts folder contains prebuilt st.cmd files for various AreaDetector drivers. The standardizeIOC script can be used to set up an IOC on the file system to use this deployment. The script takes two arguments: (1) a path to the IOC folder, and (2) the areaDetector driver the IOC uses.
- Note: standardizeIOC, /scripts, and /prebuilts come from folders in the ioc_deploy repository, and will only be copied into the tarball if deploy.sh is run from the ioc_deploy folder.
bash standardizeIOC.sh /epics/iocs/cam-GC1380 ADProsilica
The script has three main functions:
- Generating an envPaths file
- This will rename the current envPaths file in the IOC folder to OLD_envPaths
- Copying epicsEnvSet calls from st.cmd into a unique.cmd file
- unique.cmd will contain all variables used in st.cmd; in the end, it will be the only file that needs to be edited
- Replacing the old st.cmd with a prebuilt st.cmd that utilizes the unique.cmd parameters
- The old st.cmd is moved to OLD_st.cmd
Additionally, the script adds a config file to the IOC for use in automation.
After running this script, the IOC at that location will be set up to use the resources at this deployment. As long as the deployment is not moved and the names of the component folders are not changed, this script only needs to be run once for every IOC that uses this deployment; after that point, the deployment can be updated as regularly as needed without having to update the IOC again. However, since envPaths uses absolute paths it must be re-generated for every IOC if a folder name in the deployment changes or if the deployment is moved. The script for only regenerating envPaths can be found in the deployment’s scripts folder.