From: Jeff Layton Date: Tue, 26 Mar 2019 15:01:49 +0000 (-0400) Subject: vstart: generate environment script suitable for sourcing X-Git-Tag: v15.1.0~3031^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=967d8327694a268d67f8987fab0a39f23438d2c3;p=ceph.git 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 --- diff --git a/src/vstart.sh b/src/vstart.sh index 861fb58684f7..f3f3a31244f1 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"