aboutsummaryrefslogtreecommitdiff
path: root/tweed.hashdist.post-install
blob: 8d296201bb8ef63eb057e90f31d00a4226085b6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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