aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tweed.hashdist.post-install44
1 files changed, 44 insertions, 0 deletions
diff --git a/tweed.hashdist.post-install b/tweed.hashdist.post-install
new file mode 100644
index 0000000..8d29620
--- /dev/null
+++ b/tweed.hashdist.post-install
@@ -0,0 +1,44 @@
+# Tweed --- Package management for engineering software
+# Copyright (C) 2016 Paul Garlick <pgarlick@tourbillion-technology.com>
+#
+# Tweed is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tweed. If not, see <http://www.gnu.org/licenses/>.
+
+# create a .hashdist-profile directory if it does not already exist
+mkdir -p $HOME/.hashdist-profile
+
+# set configuration filename
+CONFIG_FILE=$HOME/.hashdist-profile/hashdist.sh
+
+# read link to HashDist profile and confirm HashDist store location
+PROFILE=default
+PROFILE=$(readlink $PROFILE)
+PROFILE=$(basename $PROFILE)
+HASHDIST_BUILD_STORE=$(grep build_stores: -A1 ~/.hashdist/config.yaml | tail -1 | cut -f2 -d: | tr -d ' ')
+if [ "x$HASHDIST_BUILD_STORE" = "x./bld" ]; then
+ HASHDIST_BUILD_STORE="$HOME/.hashdist/bld"
+fi
+
+# write environment variables to configuration file
+cat << EOF > $CONFIG_FILE
+# HashDist configuration file
+# created by $0 on $(date)
+
+export PROFILE="$PROFILE"
+export PROFILE_INSTALL_DIR="$HASHDIST_BUILD_STORE/profile/$PROFILE"
+export PATH="$PROFILE_INSTALL_DIR/bin:$PATH"
+export MANPATH="$PROFILE_INSTALL_DIR/share/man:"
+export CMAKE_PREFIX_PATH="$PROFILE_INSTALL_DIR:$CMAKE_PREFIX_PATH"
+export PYTHONPATH="$PROFILE_INSTALL_DIR/lib/python2.7/site-packages:$PYTHONPATH"
+export INSTANT_CACHE_DIR="$HOME/.cache/instant/$PROFILE"
+EOF