From 5671731b8de43ddc44ee7de3705acad5bba12bfe Mon Sep 17 00:00:00 2001 From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl> Date: Fri, 3 Apr 2020 20:07:40 +0200 Subject: [PATCH] Add check that filename begins with /hosthome This ensures that the file can be store in the host ${HOME} dir outside of the container. Also added ${TANGO_CONTAINER_ENV} that sets environment variables --- tools/ConfigDb/load_ConfigDb.sh | 6 +++++- tools/ConfigDb/update_ConfigDb.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/ConfigDb/load_ConfigDb.sh b/tools/ConfigDb/load_ConfigDb.sh index 9333f6814..e3fe552e1 100755 --- a/tools/ConfigDb/load_ConfigDb.sh +++ b/tools/ConfigDb/load_ConfigDb.sh @@ -1,5 +1,9 @@ if [ ${#} -ne 1 ]; then echo "You must provide a file name for the TANGO_HOST DB dump!" exit -1 +# Check if the filename begins with /hosthome: +elif [ ${1##/hosthome/} != ${1//\/hosthome\//} ]; then + echo "You must provide a filename that begins with \"/hosthome/\". Why is that? Because the file needs to be stored from within the container to the hosts file system and your HOME directory will be mounted as /hosthome." + exit -2 fi -docker exec -it dsconfig json2tango --write ${1} +docker exec -it ${TANGO_CONTAINER_ENV} dsconfig json2tango --write ${1} diff --git a/tools/ConfigDb/update_ConfigDb.sh b/tools/ConfigDb/update_ConfigDb.sh index 75081d3bd..80febaecc 100755 --- a/tools/ConfigDb/update_ConfigDb.sh +++ b/tools/ConfigDb/update_ConfigDb.sh @@ -1,5 +1,9 @@ if [ ${#} -ne 1 ]; then echo "You must provide a file name for the TANGO_HOST DB dump!" exit -1 +# Check if the filename begins with /hosthome: +elif [ ${1##/hosthome/} != ${1//\/hosthome\//} ]; then + echo "You must provide a filename that begins with \"/hosthome/\". Why is that? Because the file needs to be stored from within the container to the hosts file system and your HOME directory will be mounted as /hosthome." + exit -2 fi -docker exec -it dsconfig json2tango --update ${1} +docker exec -it ${TANGO_CONTAINER_ENV} dsconfig json2tango --update ${1} -- GitLab