diff --git a/sbin/load_ConfigDb.sh b/sbin/load_ConfigDb.sh index 96432f31cc960e2115ed4f0e797927a99363a032..f7c7536892d7bfd978d31736cf2a535939acd9df 100755 --- a/sbin/load_ConfigDb.sh +++ b/sbin/load_ConfigDb.sh @@ -10,23 +10,9 @@ else help "A file name must be provided." fi -# Check if the filename begins with /hosthome/, /opt/lofar2.0/tango or -# /opt/lofar2.0/ or if it is in the ${HOME} directory: -if [ ${1:0:10} != /hosthome/ -a ${1:0:20} != /opt/lofar2.0/tango/ -a ${1:0:14} != /opt/lofar2.0/ ]; then - pushd $(dirname ${file}) >/dev/null - full_path=${PWD} - popd >/dev/null - # Check if the file's directory begins with ${HOME}. Then it can be - # accessed via /hosthome. The replacement will then shorten the result. - home_replaced=${full_path#${HOME}} - if [ ${#home_replaced} -ne ${#full_path} ]; then - if [ ! -f ${file} ]; then - help "The file \"${1}\" does not exist." - fi +# copy file into container to read it from container, as the file's location +# in the container won't be the same as on the host. +docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json - # The file can be accessed through /hosthome. Modify the parameter. - file=/hosthome${home_replaced}/$(basename ${file}) - fi -fi - -docker exec -it dsconfig json2tango --write ${file} +# write settings +docker exec -it dsconfig json2tango --write /tmp/dsconfig-load-settings.json diff --git a/sbin/update_ConfigDb.sh b/sbin/update_ConfigDb.sh index 0f22b48cbe52751a1b52c210ff685eb988d4f7dd..25cb31a8554546d33d94fe1278cbaca968277488 100755 --- a/sbin/update_ConfigDb.sh +++ b/sbin/update_ConfigDb.sh @@ -10,28 +10,9 @@ else help "A file name must be provided." fi -# Check if the filename begins with /hosthome/, /opt/lofar2.0/tango or -# /opt/lofar2.0/ or if it is in the ${HOME} directory: -if [ ${1:0:10} != /hosthome/ -a ${1:0:20} != /opt/lofar2.0/tango/ -a ${1:0:14} != /opt/lofar2.0/ ]; then - pushd $(dirname ${file}) >/dev/null - full_path=${PWD} - popd >/dev/null - # Check if the file's directory begins with ${HOME}. Then it can be - # accessed via /hosthome. The replacement will then shorten the result. - home_replaced=${full_path#${HOME}} - if [ ${#home_replaced} -ne ${#full_path} ]; then - if [ ! -f ${file} ]; then - help "The file \"${1}\" does not exist." - fi +# copy file into container to read it from container, as the file's location +# in the container won't be the same as on the host. +docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json - # The file can be accessed through /hosthome. Modify the parameter. - file=/hosthome${home_replaced}/$(basename ${file}) - else - # The file is in one of the two: /opt/lofar2.0/tango/ /opt/lofar2.0/ - # Provide the full path since it is accessible from within the docker - # image because both directories are mounted. - file=${full_path}/$(basename ${file}) - fi -fi - -docker exec -it dsconfig json2tango --write --update ${file} +# update settings +docker exec -it dsconfig json2tango --write --update /tmp/dsconfig-update-settings.json