Skip to content

Commit

Permalink
simpilfy ioc layout in the TFTP server
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Mar 21, 2024
1 parent ac1a483 commit e38befa
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/rtems_proxy/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ def copy_rtems():
root = GLOBALS.RTEMS_ROOT
# root of the path that the RTEMS IOC expects to find the IOC files
rtems_root = Path("/iocs") / GLOBALS.IOC_GROUP / GLOBALS.IOC_NAME
# the binary blob to load into the RTEMS IOC via TFTP
ioc_bin = (GLOBALS.IOC / "bin") / GLOBALS.EPICS_TARGET_ARCH / "ioc.boot"
# where to copy the Generic IOC folder to (at present only holds the dbd folder)
dest_ioc = root / "ioc"
# where to copy the generated runtime assets to (st.cmd and ioc.db)
dest_runtime = root / "runtime"

# because we are moving the ioc files we need to fix up startup script paths
startup = GLOBALS.RUNTIME / "st.cmd"
cmd_txt = startup.read_text()
cmd_txt = re.sub("/epics/", f"{str(rtems_root)}/", cmd_txt)
startup.write_text(cmd_txt)
# clean up previous IOC binaries
shutil.rmtree(dest_ioc, ignore_errors=True)
shutil.rmtree(dest_runtime, ignore_errors=True)

# move all the files needed for runtime into the PVC that is being shared
# over nfs/tftp by the nfsv2-tftp service
Path.mkdir(dest_ioc, exist_ok=True)
shutil.copytree(GLOBALS.IOC / "dbd", dest_ioc, symlinks=True, dirs_exist_ok=True)
shutil.copytree(GLOBALS.RUNTIME, root / "runtime", dirs_exist_ok=True)
shutil.copy(ioc_bin, root)
shutil.copytree(GLOBALS.RUNTIME, dest_runtime, dirs_exist_ok=True)

# because we moved the ioc files we need to fix up startup script paths
startup = dest_runtime / "st.cmd"
cmd_txt = startup.read_text()
cmd_txt = re.sub("/epics/", f"{str(rtems_root)}/", cmd_txt)
startup.write_text(cmd_txt)

0 comments on commit e38befa

Please sign in to comment.