From 967d8327694a268d67f8987fab0a39f23438d2c3 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 26 Mar 2019 11:01:49 -0400 Subject: [PATCH] vstart: generate environment script suitable for sourcing At the end, vstart.sh will print out some commands to set up the environment variables suitably for running things out of the tree. Unfortunately, they just go to stdout so it's hard to refer to them from other shells. Have it tee those lines to a separate vstart_environment.sh file that can be sourced into the local environment. While we're at it, let's not use relative paths here, as that makes the validity of these paths depend on the cwd. Signed-off-by: Jeff Layton --- src/vstart.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index 861fb58684f..f3f3a31244f 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -1224,13 +1224,23 @@ if [ "$new" -eq 1 ]; then echo "" fi echo "" -echo "export PYTHONPATH=./pybind:$PYTHONPATH" -echo "export LD_LIBRARY_PATH=$CEPH_LIB" +# add header to the environment file +{ + echo "#" + echo "# source this file into your shell to set up the environment." + echo "# For example:" + echo "# $ . $CEPH_DIR/vstart_environment.sh" + echo "#" +} > $CEPH_DIR/vstart_environment.sh +{ + echo "export PYTHONPATH=$PYBIND:$CEPH_LIB/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}:\$PYTHONPATH" + echo "export LD_LIBRARY_PATH=$CEPH_LIB:\$LD_LIBRARY_PATH" -if [ "$CEPH_DIR" != "$PWD" ]; then - echo "export CEPH_CONF=$conf_fn" - echo "export CEPH_KEYRING=$keyring_fn" -fi + if [ "$CEPH_DIR" != "$PWD" ]; then + echo "export CEPH_CONF=$conf_fn" + echo "export CEPH_KEYRING=$keyring_fn" + fi +} | tee -a $CEPH_DIR/vstart_environment.sh echo "CEPH_DEV=1" -- 2.39.5