]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart: generate environment script suitable for sourcing 27198/head
authorJeff Layton <jlayton@redhat.com>
Tue, 26 Mar 2019 15:01:49 +0000 (11:01 -0400)
committerJeff Layton <jlayton@redhat.com>
Sun, 31 Mar 2019 12:55:52 +0000 (08:55 -0400)
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 <jlayton@redhat.com>
src/vstart.sh

index 861fb58684f7372c0ddef84d3d8f94f8a2485337..f3f3a31244f1fd71992a2ca7e3c3a66454924e26 100755 (executable)
@@ -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"